Migrations v2 Source Target
VersionScript 1… 2… Migrations v2 Source Target VersionScript 1… 2… 3… 4…
VersionScript 1… 2… 3… 4… Migrations v2 Source Target VersionScript 1… 2… 3… 4… Step 1 1.Deploy and execute migration scripts
VersionScript 1… 2… 3… 4… Migrations v2 Source Target VersionScript 1… 2… 3… 4… 1.Deploy and execute migration scripts 2.Use SQL Compare to deploy remaining changes Step 1 Step 2
VersionScript 1… 2… 3… 4… Migrations v2 Source Target VersionScript 1… 2… 3… 4… 1.Deploy and execute migration scripts 2.Use SQL Compare to deploy remaining changes Step 1 Step 2 BEGIN TRANSACTION COMMIT TRANSACTION
Migrations v2 Example migration script IF some condition BEGIN EXEC some script END
Migrations v2 Example migration script (renaming MyTable to MyTable2) BIT = 1 IF (old dbo.MyTable does not exist) BEGIN = 0; END = 1 BEGIN EXEC sp_rename END
Migrations v2 Example migration script (renaming MyTable to MyTable2) BIT = 1 IF NOT EXISTS (SELECT 1 FROM [information_schema].[Tables] WHERE table_schema = 'dbo' AND TABLE_NAME = ‘MyTable') BEGIN = 0; PRINT 'Object ''[dbo].[MyTable]'' could not be found - skipping migration.'; END = 1 BEGIN EXEC sp_rename '[dbo].[MyTable]', 'MyTable2' END
VersionScript 1… 2… 3… 4… Migrations v2 Source Target VersionScript 1… 2… 3… 4… 1.Deploy and execute migration scripts 2.Use SQL Compare to deploy remaining changes Step 1 Step 2 BEGIN TRANSACTION COMMIT TRANSACTION