
--Migration_RCCP_20230710_130259.txt
CREATE TABLE [dbo].[Events] (
    [Id] [bigint] NOT NULL IDENTITY,
    [Name] [nvarchar](max),
    [EventType] [int] NOT NULL,
    [EventStartDate] [datetime] NOT NULL,
    [EventEndDate] [datetime] NOT NULL,
    [EvalutationStartDate] [datetime] NOT NULL,
    [EvalutationEndDate] [datetime] NOT NULL,
    [CompanyId] [bigint] NOT NULL,
    [CreatedUserId] [bigint] NOT NULL,
    [CreatedDateTime] [datetime] NOT NULL,
    [IsDeleted] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.Events] PRIMARY KEY ([Id])
)
ALTER TABLE [dbo].[EventTypes] ADD [IsActive] [bit] NOT NULL DEFAULT 0
ALTER TABLE [dbo].[EventTypes] ADD [IsDeleted] [bit] NOT NULL DEFAULT 0
DECLARE @var0 nvarchar(128)
SELECT @var0 = name
FROM sys.default_constraints
WHERE parent_object_id = object_id(N'dbo.EventTypes')
AND col_name(parent_object_id, parent_column_id) = 'CompanyId';
IF @var0 IS NOT NULL
    EXECUTE('ALTER TABLE [dbo].[EventTypes] DROP CONSTRAINT [' + @var0 + ']')
ALTER TABLE [dbo].[EventTypes] DROP COLUMN [CompanyId]
