I am releasing a newer version of my Windows application. There are DB schema changes in the new version. Also I do not want to lose the data.
So the approach that I have taken is to replace the dlls while preserving the database. In order to upgarde the database, I am planning to compare the database schema of the old database and make necessary changes.
So how can I compare the database structure (schema) of old one to new one and how can I detect the changes and correct it. What I have tried so far is try and get the database schema using GetSchema
method.
But since the new schema is a predefined one, How can I inject the new schema into the program and compare with the existing one in the site where older was installed.
To compare database definitions. On the Tools menu, select SQL Server, and then click New Schema Comparison. Alternatively, right-click the TradeDev project in Solution Explorer, and select Schema Compare. The Schema Compare window opens, and Visual Studio automatically assigns it a name such as SqlSchemaCompare1 .
if you open a model tab, and select the databases menu, you get a compare schemas option, which you can use to compare two different schemas on two different servers, or two schemas on the same server, or a schema and a model, or a lot of other options i haven't tried yet.
Right-click on the right/left panel and click the Difference highlights option from the context menu. Go to the View tab in the main application window and click the Difference highlights button.
We use SQL Compare from RedGate, but it's not particularly cheap.
SQL Compare
This lets us compare the structure of two databases, and creates a SQL script to update one of the databases to match the other.
Create your Database Migration scripts and run them with a tool such as Db Up to keep track of schema changes. SQL Scripts migrate your database from version 1 to 2, 2 to 3, etc. Schema Compare is another option mentioned in a previous question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With