How to update schema? - ydn-db

Is there any way to update schema? I've created a db with schema now I want to add an index to it. How to add an extra index to existing store?
Thanks,
-Kesav

Just change your schema. If you define schema version, remember to increase it.

Yes. If you use SQL Server, on management studio you change your table e save the new Schema. Then you run this script.

Related

Get LINQ TO SQL to create a new file for each entity

Iam in my project retriving data from my database with "LINQ TO SQL"
My problem is that LINQ to SQL have created ONE file with name "Hit.designer.css"
And this file got all my Entity/MODELS for Car,Bike,Airplane.
Is it possible that LINQ TO SQL create a new file for every Entity ?
Have you considered EntityFramework?
This framework allows you to use your database tables as entities in your code.
https://msdn.microsoft.com/en-us/library/aa937723(v=vs.113).aspx
http://www.entityframeworktutorial.net/what-is-entityframework.aspx
Hope this helps!

How use only one schema on flyway

I need to work only with one schema on flyway.
but when i use
Flyway flyway = new Flyway();
flyway.setDataSource(ConectorWatson);
flyway.setSchemas("db_watson");
flyway.migrate();
the flyway create one schema_version on my pulic schema and db_watson.
can i only use db_watson ?
tks
Flyway only creates a schema_version table in the first schema configured. This defaults to the one of the connection. When you set flyway.setSchemas() it changes it to the first of that list, and uses that one.
In your case this means, with the configuration you have there, Flyway only creates a schema_version table in the db_watson schema.
If you noticed something different, please file an issue with exact steps to reproduce.

Creating .edmx file programmatically

Is there any way to create edmx file programmatically without configuring manually.
My requirement is like this: I have to create a website dynamically. In that website I have to use EF files. ie. I have to create edmx file programatically and not manually. I have the Database name, connection string, server name, username, password and all with me.
Is there any way to achieve this?
I have found the solution. The following link helps those who want to create edmx file programmatically in VS 2012.
https://bitbucket.org/cincura_net/edmgen2/
This is a new thread. Will be helpful for those who found EdmxGen2 is not compatable with vs 2010.
Thanks,
Sujith.S
Yes, you can have a look at edmgen2.exe for info on how to create the edmx programitically. http://archive.msdn.microsoft.com/EdmGen2

I've a sql database file I want to use asp_regsql.exe tool to put asp.net membership provider

I've a sql database file I want to use asp_regsql.exe tool to put asp.net membership provider
The main problem that I can't use the asp_regsql.exe to add the tables that I need ,
I tried various of connections ,
If some one got a CREATE sql file that contains the membership table construction it would help ,
Thank you in advance
Check out this tip I have written in code project. Simply, you can call the following once:
System.Web.Management.SqlServices.Install("YOUR_DATABASE", SqlFeatures.All, "YOUR_CONNECTION_STRING");
You can find the SQL script # %WINDOWS%\Microsoft.NET\Framework\v2.0.50727\InstallCommon.sql
Source: https://web.archive.org/web/20211020203214/https://www.4guysfromrolla.com/articles/040506-1.aspx

update .dbml file

How to update .dbml file after making some changes in the database.
There's no built-in way to sync the dbml file/datacontext with the database after making changes (besides regenerating the entire dbml file by removing all or a selection of the entities and re-dragging them, or by using sqlmetal as suggested by other replies), but there are third-party tools that add refresh functionality to the Visual Studio L2S designer.
One such tool is my add-in, Huagati DBML/EDMX Tools. You can download it from http://www.huagati.com/dbmltools/ and get a trial license if you want to take it for a test spin.
Jim Wooley has a summary various Linq and Linq-to-SQL tools here:
http://www.thinqlinq.com/default/LINQ-Tools.aspx
...and Damien Guard has a list of tools/resources for L2S here:
http://damieng.com/blog/2009/06/04/linq-to-sql-resources
The only way to do this is to delete the objects from the dbml interface, and re-add them back. Make sure that you hit Refresh in the Server Explorer panel after making changes to the database so that Visual Studio picks up the latest changes to the database when it creates the objects in the dbml.
SQLMetal is the tool you want. It installs with Visual Studio as part of the SDK. For most dbml, however, I've found the delete/re-add technique to be a bit more expedient and reliable.
There is no way to auto refresh the DBML to match the database. If you have added new tables to the datbase you can simply drage them into the designer window. If you have added or changed fields on existing tables or altered foreign keys/relationships, your best bet is to manually edit the classes and properties in the DBML file. ~You can delete them and the drag them back in from server explorer which will refrech them from the datbase but you will lose any custom modifications you have made such as changing properties from public to protected or setting up inhertance or other things.

Resources