[dbo].[SakariScheduledMessage]
CREATE TABLE [dbo].[SakariScheduledMessage]
(
[SakariScheduledMessageID] [int] NOT NULL IDENTITY(1, 1),
[SakariConversationFID] [int] NOT NULL,
[SakariContactFID] [int] NOT NULL,
[TextMessage] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[CreatedAt] [datetimeoffset] NOT NULL,
[SentBy] [int] NOT NULL,
[ToBeSentAt] [datetimeoffset] NOT NULL,
[ErrorMessage] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[SakariScheduledMessage] ADD CONSTRAINT [PK_SakariScheduledMessageID] PRIMARY KEY NONCLUSTERED ([SakariScheduledMessageID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_SakariScheduledMessage_ToBeSentAt] ON [dbo].[SakariScheduledMessage] ([ToBeSentAt]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SakariScheduledMessage] ADD CONSTRAINT [FK_SakariScheduledMessage_SakariContact] FOREIGN KEY ([SakariContactFID]) REFERENCES [dbo].[SakariContact] ([SakariContactID])
GO
ALTER TABLE [dbo].[SakariScheduledMessage] ADD CONSTRAINT [FK_SakariScheduledMessage_SakariConversation] FOREIGN KEY ([SakariConversationFID]) REFERENCES [dbo].[SakariConversation] ([SakariConversationID])
GO
ALTER TABLE [dbo].[SakariScheduledMessage] ADD CONSTRAINT [FK_SakariScheduledMessage_Sysuser] FOREIGN KEY ([SentBy]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[SakariScheduledMessage] TO [MssExec]
GRANT INSERT ON [dbo].[SakariScheduledMessage] TO [MssExec]
GRANT DELETE ON [dbo].[SakariScheduledMessage] TO [MssExec]
GRANT UPDATE ON [dbo].[SakariScheduledMessage] TO [MssExec]
GO