Update idempotent EF migration script for prod deploy
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7120,3 +7120,137 @@ GO
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE [PowderCatalogItems] ADD [SpecificGravity] decimal(18,2) NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE [InventoryItems] ADD [SpecificGravity] decimal(18,2) NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T12:35:37.6945288Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T12:35:37.6945294Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T12:35:37.6945296Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260506123541_AddSpecificGravityToPowderCatalogAndInventory', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE [QuoteItems] ADD [IncludePrepCost] bit NOT NULL DEFAULT CAST(0 AS bit);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
UPDATE QuoteItems SET IncludePrepCost = 1 WHERE CatalogItemId IS NULL
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T19:59:56.2640846Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T19:59:56.2640852Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-05-06T19:59:56.2640853Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260506195959_AddQuoteItemIncludePrepCost'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260506195959_AddQuoteItemIncludePrepCost', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
|
||||
Reference in New Issue
Block a user