Reputation: 1189
I know you can compare and sync data between databases in Visual Studio using SSDT. But is there a way to compare DB data in DB project vs actual DB?
We currently use RedGate to sync schema and data and normally when someone makes a data change in their local DB he syncs it with redgate project scripts and checks them in to GIT so that everyone can sync their local DBs with those redgate scripts to be up to date. RedGate became too expensive and we are looking at the alternatives and looks like Visual Studio has SSDT that allows to do these kind of things.
So I was able to create a database project in VS and import the schema from the DB so now all developers be up to date if schema changes but it doesn't have an option to do the same thing with DB data. No option to create data scripts (and add them to the database project) to compare with DB, as I said it only allows you to do data compare between DBs but not between DB and the DB project scripts, at least that's what I found so far. Is there even a way to do it so that we can include data scripts and be able to sync them with DBs?
Upvotes: 2
Views: 1059
Reputation: 4035
You could check in MERGE-scripts for static tables and include them as Post Scripts. The merge statements will ensure that your target tables have the correct rows when publishing (insert/update/delete in the merge will do this). Make one merge script file per table, and include them all in your Post Script File. Only difference/downside is that you can not import into the merge script, you have to type in the code to get it version controlled, or write an SP that generates the SQL Merge statement.
Upvotes: 0