Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Publish data with SSDT?

I have a SSDT-project. When publishing a new version I want to publish/initialize some data in the database as well. Can that be done using SSDT?

like image 738
Erik Z Avatar asked Apr 16 '13 05:04

Erik Z


3 Answers

It can be done, but could be tricky. If you set up a variable in the project that can be used for "New" releases, you could put that in your post-deploy script as a section that would run a series of inserts, but only for that "New" type.

As David mentioned, the better way would likely be to use something like Red-Gate's data compare or run the scripts after creating the database. It's possible to do it in post-deploy scripts, but could prove tricky.

Something like this could work:

IF '$(DeployType)' = 'New'
BEGIN --"New" release scripts
PRINT 'Post-Deploy Scripts for release.'
:r .\InsertScript1.sql
:r .\InsertScript2.sql
--etc
END --"New" release scripts
like image 137
Peter Schott Avatar answered Jan 01 '23 13:01

Peter Schott


This isn't possible in SSDT. The current guidance is to use a post-deployment script.

Redgate ReadyRoll provides many experiences familiar to SSDT users, but has improved static data management as well as many other improvements.

like image 40
David Atkinson Avatar answered Jan 01 '23 11:01

David Atkinson


We include Merge-scripts automatically, when they are placed in a specific subfolder of the Project.

like image 45
SAS Avatar answered Jan 01 '23 11:01

SAS