
--Migration_RCCP_20251002_085519.txt
CREATE TABLE [dbo].[RemarkRelatedEntityLinks] (
    [Id] [uniqueidentifier] NOT NULL DEFAULT newsequentialid(),
    [RemarkId] [uniqueidentifier] NOT NULL,
    [EntityType] [nvarchar](max),
    [EntityId] [nvarchar](max),
    CONSTRAINT [PK_dbo.RemarkRelatedEntityLinks] PRIMARY KEY ([Id])
)
ALTER TABLE [dbo].[DeviceLiveViews] ADD [CreateDateDate] [datetime] NOT NULL DEFAULT '1900-01-01T00:00:00.000'
ALTER TABLE [dbo].[DeviceLiveViews] ADD [Link] [nvarchar](max)
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.DeviceLiveViews')
AND col_name(parent_object_id, parent_column_id) = 'CreateDate';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[DeviceLiveViews] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[DeviceLiveViews] DROP COLUMN [CreateDate]
DECLARE @var1 nvarchar(128)
SELECT @var1 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.DeviceLiveViews')
AND col_name(parent_object_id, parent_column_id) = 'S3Link';
IF @var1 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[DeviceLiveViews] DROP CONSTRAINT [' + @var1 + ']')
ALTER TABLE [dbo].[DeviceLiveViews] DROP COLUMN [S3Link]
DECLARE @var2 nvarchar(128)
SELECT @var2 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.SessionInstanceJobs')
AND col_name(parent_object_id, parent_column_id) = 'SiteId';
IF @var2 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[SessionInstanceJobs] DROP CONSTRAINT [' + @var2 + ']')
ALTER TABLE [dbo].[SessionInstanceJobs] DROP COLUMN [SiteId]
DECLARE @var3 nvarchar(128)
SELECT @var3 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.SessionInstanceJobs')
AND col_name(parent_object_id, parent_column_id) = 'Timezone';
IF @var3 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[SessionInstanceJobs] DROP CONSTRAINT [' + @var3 + ']')
ALTER TABLE [dbo].[SessionInstanceJobs] DROP COLUMN [Timezone]
DROP TABLE [dbo].[EntityRemarkSubEventTypeLinks]
