Download presentation
Presentation is loading. Please wait.
Published byLuc Parcell Modified over 9 years ago
1
Migrations v2 Source Target
2
VersionScript 1… 2… Migrations v2 Source Target VersionScript 1… 2… 3… 4…
3
VersionScript 1… 2… 3… 4… Migrations v2 Source Target VersionScript 1… 2… 3… 4… Step 1 1.Deploy and execute migration scripts
4
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
5
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
6
Migrations v2 Example migration script IF some condition BEGIN EXEC some script END
7
Migrations v2 Example migration script (renaming MyTable to MyTable2) DECLARE @ShouldRunMigrationScript BIT SET @ShouldRunMigrationScript = 1 IF (old dbo.MyTable does not exist) BEGIN SET @ShouldRunMigrationScript = 0; END IF @ShouldRunMigrationScript = 1 BEGIN EXEC sp_rename END
8
Migrations v2 Example migration script (renaming MyTable to MyTable2) DECLARE @ShouldRunMigrationScript BIT SET @ShouldRunMigrationScript = 1 IF NOT EXISTS (SELECT 1 FROM [information_schema].[Tables] WHERE table_schema = 'dbo' AND TABLE_NAME = ‘MyTable') BEGIN SET @ShouldRunMigrationScript = 0; PRINT 'Object ''[dbo].[MyTable]'' could not be found - skipping migration.'; END IF @ShouldRunMigrationScript = 1 BEGIN EXEC sp_rename '[dbo].[MyTable]', 'MyTable2' END
9
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.