[dbo].[OutgoingEmailQueue]
CREATE TABLE [dbo].[OutgoingEmailQueue]
(
[OutgoingEmailQueueID] [int] NOT NULL IDENTITY(1, 1),
[OutgoingEmailFID] [int] NOT NULL,
[EnqueuedAt] [datetimeoffset] NOT NULL CONSTRAINT [DF_OutgoingEmailQueue_EnqueuedAt] DEFAULT (sysdatetimeoffset())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OutgoingEmailQueue] ADD CONSTRAINT [PK_OutgoingEmailQueue] PRIMARY KEY CLUSTERED ([OutgoingEmailQueueID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_OutgoingEmailQueue_OutgoingEmailFID] ON [dbo].[OutgoingEmailQueue] ([OutgoingEmailFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[OutgoingEmailQueue] ADD CONSTRAINT [FK_OutgoingEmailQueue_OutgoingEmail] FOREIGN KEY ([OutgoingEmailFID]) REFERENCES [dbo].[OutgoingEmail] ([OutgoingEmailID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[OutgoingEmailQueue] TO [MssExec]
GRANT INSERT ON [dbo].[OutgoingEmailQueue] TO [MssExec]
GRANT DELETE ON [dbo].[OutgoingEmailQueue] TO [MssExec]
GRANT UPDATE ON [dbo].[OutgoingEmailQueue] TO [MssExec]
GO