
--Migration_RCCP_20220308_110048.txt
CREATE TABLE [dbo].[CompanyBusPostProcesses] (
    [Id] [uniqueidentifier] NOT NULL DEFAULT newsequentialid(),
    [ServerGuid] [nvarchar](max),
    [CompanyId] [bigint] NOT NULL,
    [NeedPostProcess] [bit] NOT NULL,
    CONSTRAINT [PK_dbo.CompanyBusPostProcesses] PRIMARY KEY ([Id])
)
CREATE TABLE [dbo].[CompanyBusPostProcessLogs] (
    [Id] [uniqueidentifier] NOT NULL DEFAULT newsequentialid(),
    [ServerGuid] [nvarchar](max),
    [CompanyId] [bigint] NOT NULL,
    [ProcessedDate] [datetime] NOT NULL,
    [FileUrl] [nvarchar](max),
    [Status] [bigint] NOT NULL,
    [Message] [nvarchar](max),
    CONSTRAINT [PK_dbo.CompanyBusPostProcessLogs] PRIMARY KEY ([Id])
)
CREATE INDEX [IX_CompanyId] ON [dbo].[CompanyBusPostProcesses]([CompanyId])
CREATE INDEX [IX_CompanyId] ON [dbo].[CompanyBusPostProcessLogs]([CompanyId])
ALTER TABLE [dbo].[CompanyBusPostProcesses] ADD CONSTRAINT [FK_dbo.CompanyBusPostProcesses_dbo.Companies_CompanyId] FOREIGN KEY ([CompanyId]) REFERENCES [dbo].[Companies] ([ID]) ON DELETE CASCADE
ALTER TABLE [dbo].[CompanyBusPostProcessLogs] ADD CONSTRAINT [FK_dbo.CompanyBusPostProcessLogs_dbo.Companies_CompanyId] FOREIGN KEY ([CompanyId]) REFERENCES [dbo].[Companies] ([ID]) ON DELETE CASCADE
