Initial commit
This commit is contained in:
@@ -0,0 +1,728 @@
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
DROP INDEX [IX_InventoryItems_SKU] ON [InventoryItems];
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:47:18.8788284Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:47:18.8788291Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:47:18.8788292Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_InventoryItems_CompanyId_SKU] ON [InventoryItems] ([CompanyId], [SKU]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402184721_FixInventorySkuUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260402184721_FixInventorySkuUniqueIndex', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
DROP INDEX [IX_Jobs_ShopAccessCode] ON [Jobs];
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:52:13.7857008Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:52:13.7857015Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T18:52:13.7857016Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_Jobs_CompanyId_ShopAccessCode] ON [Jobs] ([CompanyId], [ShopAccessCode]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402185216_FixJobShopAccessCodeUniqueIndex'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260402185216_FixJobShopAccessCodeUniqueIndex', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402224949_AddDashboardTips'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [DashboardTips] (
|
||||
[Id] int NOT NULL IDENTITY,
|
||||
[TipText] nvarchar(max) NOT NULL,
|
||||
[IsActive] bit NOT NULL,
|
||||
[CreatedAt] datetime2 NOT NULL,
|
||||
CONSTRAINT [PK_DashboardTips] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402224949_AddDashboardTips'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T22:49:46.0354841Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402224949_AddDashboardTips'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T22:49:46.0354847Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402224949_AddDashboardTips'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-02T22:49:46.0354849Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260402224949_AddDashboardTips'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260402224949_AddDashboardTips', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260403000650_AddStripeWebhookEvents'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [StripeWebhookEvents] (
|
||||
[Id] bigint NOT NULL IDENTITY,
|
||||
[EventId] nvarchar(max) NOT NULL,
|
||||
[EventType] nvarchar(max) NOT NULL,
|
||||
[CompanyId] int NULL,
|
||||
[RawJson] nvarchar(max) NOT NULL,
|
||||
[Status] int NOT NULL,
|
||||
[ErrorMessage] nvarchar(max) NULL,
|
||||
[ReceivedAt] datetime2 NOT NULL,
|
||||
[ProcessedAt] datetime2 NULL,
|
||||
CONSTRAINT [PK_StripeWebhookEvents] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260403000650_AddStripeWebhookEvents'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-03T00:06:46.7783905Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260403000650_AddStripeWebhookEvents'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-03T00:06:46.7783912Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260403000650_AddStripeWebhookEvents'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-03T00:06:46.7783913Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260403000650_AddStripeWebhookEvents'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260403000650_AddStripeWebhookEvents', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404151636_AddAllowAccountingToPlan'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE [SubscriptionPlanConfigs] ADD [AllowAccounting] bit NOT NULL DEFAULT CAST(0 AS bit);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404151636_AddAllowAccountingToPlan'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T15:16:32.2541952Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404151636_AddAllowAccountingToPlan'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T15:16:32.2541958Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404151636_AddAllowAccountingToPlan'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T15:16:32.2541968Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404151636_AddAllowAccountingToPlan'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260404151636_AddAllowAccountingToPlan', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404194126_AddBillReceiptFilePath'
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE [Bills] ADD [ReceiptFilePath] nvarchar(max) NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404194126_AddBillReceiptFilePath'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T19:41:22.8540290Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404194126_AddBillReceiptFilePath'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T19:41:22.8540296Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404194126_AddBillReceiptFilePath'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-04T19:41:22.8540297Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260404194126_AddBillReceiptFilePath'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260404194126_AddBillReceiptFilePath', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T00:33:47.2862744Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T00:33:47.2862750Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T00:33:47.2862752Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_InventoryTransactions_TransactionType_TransactionDate] ON [InventoryTransactions] ([TransactionType], [TransactionDate]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_InventoryItems_CompanyId_IsActive] ON [InventoryItems] ([CompanyId], [IsActive]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_InventoryItems_IsActive] ON [InventoryItems] ([IsActive]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_Bills_CompanyId_Status] ON [Bills] ([CompanyId], [Status]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_Bills_DueDate] ON [Bills] ([DueDate]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_Bills_Status] ON [Bills] ([Status]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
CREATE INDEX [IX_Appointments_ScheduledStartTime] ON [Appointments] ([ScheduledStartTime]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405003350_AddPerformanceIndexes'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260405003350_AddPerformanceIndexes', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [PlatformSettings] (
|
||||
[Id] int NOT NULL IDENTITY,
|
||||
[Key] nvarchar(200) NOT NULL,
|
||||
[Value] nvarchar(max) NULL,
|
||||
[Label] nvarchar(max) NULL,
|
||||
[Description] nvarchar(max) NULL,
|
||||
[GroupName] nvarchar(max) NULL,
|
||||
[UpdatedAt] datetime2 NULL,
|
||||
[UpdatedBy] nvarchar(max) NULL,
|
||||
CONSTRAINT [PK_PlatformSettings] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
CREATE UNIQUE INDEX [IX_PlatformSettings_Key] ON [PlatformSettings] ([Key]);
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
IF EXISTS (SELECT * FROM [sys].[identity_columns] WHERE [name] IN (N'Id', N'Key', N'Value', N'Label', N'Description', N'GroupName') AND [object_id] = OBJECT_ID(N'[PlatformSettings]'))
|
||||
SET IDENTITY_INSERT [PlatformSettings] ON;
|
||||
EXEC(N'INSERT INTO [PlatformSettings] ([Id], [Key], [Value], [Label], [Description], [GroupName])
|
||||
VALUES (1, N''AdminNotificationEmail'', NULL, N''Admin Notification Email'', N''Email address that receives platform event notifications (new signups, bug reports, subscription events). Leave blank to disable.'', N''Notifications'')');
|
||||
IF EXISTS (SELECT * FROM [sys].[identity_columns] WHERE [name] IN (N'Id', N'Key', N'Value', N'Label', N'Description', N'GroupName') AND [object_id] = OBJECT_ID(N'[PlatformSettings]'))
|
||||
SET IDENTITY_INSERT [PlatformSettings] OFF;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T15:56:49.8180443Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T15:56:49.8180449Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T15:56:49.8180450Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405155653_AddPlatformSettings'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260405155653_AddPlatformSettings', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
DECLARE @var0 sysname;
|
||||
SELECT @var0 = [d].[name]
|
||||
FROM [sys].[default_constraints] [d]
|
||||
INNER JOIN [sys].[columns] [c] ON [d].[parent_column_id] = [c].[column_id] AND [d].[parent_object_id] = [c].[object_id]
|
||||
WHERE ([d].[parent_object_id] = OBJECT_ID(N'[PlatformSettings]') AND [c].[name] = N'Key');
|
||||
IF @var0 IS NOT NULL EXEC(N'ALTER TABLE [PlatformSettings] DROP CONSTRAINT [' + @var0 + '];');
|
||||
ALTER TABLE [PlatformSettings] ALTER COLUMN [Key] nvarchar(200) NOT NULL;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
IF EXISTS (SELECT * FROM [sys].[identity_columns] WHERE [name] IN (N'Id', N'Key', N'Value', N'Label', N'Description', N'GroupName') AND [object_id] = OBJECT_ID(N'[PlatformSettings]'))
|
||||
SET IDENTITY_INSERT [PlatformSettings] ON;
|
||||
EXEC(N'INSERT INTO [PlatformSettings] ([Id], [Key], [Value], [Label], [Description], [GroupName])
|
||||
VALUES (2, N''BaseUrl'', NULL, N''Base URL'', N''Public URL of this application (e.g. https://app.powdercoatinglogix.com). Used in email links. Falls back to the current request URL if blank.'', N''General''),
|
||||
(3, N''TrialPeriodDays'', N''7'', N''Trial Period (days)'', N''Number of days a new company gets on the free trial before their subscription expires.'', N''Subscriptions''),
|
||||
(4, N''QuoteApprovalTokenDays'', N''30'', N''Quote Approval Token Validity (days)'', N''How many days a customer quote-approval link remains valid before expiring.'', N''Quotes''),
|
||||
(5, N''AuditLogRetentionDays'', N''365'', N''Audit Log Retention (days)'', N''Audit log entries older than this many days are automatically purged by the nightly job.'', N''Data Retention''),
|
||||
(6, N''StripeWebhookRetentionDays'', N''90'', N''Stripe Webhook Retention (days)'', N''Processed Stripe webhook events older than this many days are automatically purged.'', N''Data Retention'')');
|
||||
IF EXISTS (SELECT * FROM [sys].[identity_columns] WHERE [name] IN (N'Id', N'Key', N'Value', N'Label', N'Description', N'GroupName') AND [object_id] = OBJECT_ID(N'[PlatformSettings]'))
|
||||
SET IDENTITY_INSERT [PlatformSettings] OFF;
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:12:38.5900904Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:12:38.5900913Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:12:38.5900914Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405161241_AddPlatformSettingsV2'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260405161241_AddPlatformSettingsV2', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405162137_UpdateAdminEmailDescription'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PlatformSettings] SET [Description] = N''Email address(es) that receive platform event notifications (new signups, bug reports, subscription events). Separate multiple addresses with commas. Leave blank to disable.''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405162137_UpdateAdminEmailDescription'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:21:34.4700837Z''
|
||||
WHERE [Id] = 1;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405162137_UpdateAdminEmailDescription'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:21:34.4700844Z''
|
||||
WHERE [Id] = 2;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405162137_UpdateAdminEmailDescription'
|
||||
)
|
||||
BEGIN
|
||||
EXEC(N'UPDATE [PricingTiers] SET [CreatedAt] = ''2026-04-05T16:21:34.4700846Z''
|
||||
WHERE [Id] = 3;
|
||||
SELECT @@ROWCOUNT');
|
||||
END;
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20260405162137_UpdateAdminEmailDescription'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20260405162137_UpdateAdminEmailDescription', N'8.0.11');
|
||||
END;
|
||||
GO
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
Reference in New Issue
Block a user