
--Migration_RCCP_20230621_165100.txt
ALTER TABLE [dbo].[ReportFrequentTables] ADD [ReportFrequencyId] [bigint] NOT NULL DEFAULT 0
ALTER TABLE [dbo].[ReportSchedulerSettings] ADD [FrequencyValue] [nvarchar](max)
ALTER TABLE [dbo].[ReportSchedulerSettings] ADD [Recipients] [nvarchar](max)
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.ReportSchedulerSettings')
AND col_name(parent_object_id, parent_column_id) = 'OutputTemplate';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[ReportSchedulerSettings] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[ReportSchedulerSettings] ALTER COLUMN [OutputTemplate] [nvarchar](max) NULL
DECLARE @var1 nvarchar(128)
SELECT @var1 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.ReportFrequentTables')
AND col_name(parent_object_id, parent_column_id) = 'ReportFrequecyId';
IF @var1 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[ReportFrequentTables] DROP CONSTRAINT [' + @var1 + ']')
ALTER TABLE [dbo].[ReportFrequentTables] DROP COLUMN [ReportFrequecyId]
DECLARE @var2 nvarchar(128)
SELECT @var2 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.ReportSchedulerSettings')
AND col_name(parent_object_id, parent_column_id) = 'RuleId';
IF @var2 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[ReportSchedulerSettings] DROP CONSTRAINT [' + @var2 + ']')
ALTER TABLE [dbo].[ReportSchedulerSettings] DROP COLUMN [RuleId]
DECLARE @var3 nvarchar(128)
SELECT @var3 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.ReportSchedulerSettings')
AND col_name(parent_object_id, parent_column_id) = 'DayOfMonth';
IF @var3 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[ReportSchedulerSettings] DROP CONSTRAINT [' + @var3 + ']')
ALTER TABLE [dbo].[ReportSchedulerSettings] DROP COLUMN [DayOfMonth]
