sql server - SSDT implementation: Alter table insteed of Create -


we trying implement ssdt in our project.

we have lots of clients 1 of our products built on single db (dbdb) tables , stored procedures only.

we created 1 ssdt project database dbdb (using vs 2012 > sql server object browser > right click on project > new project).

once build project creates 1 .sql file.

problem: if run file on client's dbdb - creates tables again & deletes records in [this fulfills requirements deletes existing records :-( ]

what need: update not present on client's dbdb should update new changes.

note : have no direct access client's dbdb database comparing our latest dbdb. can send them magic script file update dbdb latest state.

the way update client's db compare db schemas , apply delta. way it, need way hold on schema thats running @ client:

  1. if ship versioned product, easiest deploy version n-1 of development server , compare version n going ship. way, ssdt can generate migration script need ship client pull db current schema.

  2. if don't have versioned product, or client might have altered schema or need find way extract schema data on site (maybe using ssdt there) , let ssdt create delta.

  3. option: can skip using compare feature of ssdt altogether. need write migration script yourself. each modification schema, need write ddl statements , wrap them in if clauses check old state changes made once , if old state exists. way, doesnt matter wich state wich state going script determine each step if , do.

the last flexible, requires deep testing in own , of course should have started way before situation in now, don't know changes have been anymore. can next time.

this applies schema changes on tables, because can fall drop , recreate stored procedures since there nothing lost in dropping them.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -