CREATE TABLE [dbo].[Notifications]
(
[NotificationID] [uniqueidentifier] NOT NULL,
[SubscriptionID] [uniqueidentifier] NOT NULL,
[ActivationID] [uniqueidentifier] NULL,
[ReportID] [uniqueidentifier] NOT NULL,
[SnapShotDate] [datetime] NULL,
[ExtensionSettings] [ntext] COLLATE Latin1_General_CI_AS_KS_WS NOT NULL,
[Locale] [nvarchar] (128) COLLATE Latin1_General_CI_AS_KS_WS NOT NULL,
[Parameters] [ntext] COLLATE Latin1_General_CI_AS_KS_WS NULL,
[ProcessStart] [datetime] NULL,
[NotificationEntered] [datetime] NOT NULL,
[ProcessAfter] [datetime] NULL,
[Attempt] [int] NULL,
[SubscriptionLastRunTime] [datetime] NOT NULL,
[DeliveryExtension] [nvarchar] (260) COLLATE Latin1_General_CI_AS_KS_WS NOT NULL,
[SubscriptionOwnerID] [uniqueidentifier] NOT NULL,
[IsDataDriven] [bit] NOT NULL,
[BatchID] [uniqueidentifier] NULL,
[ProcessHeartbeat] [datetime] NULL,
[Version] [int] NOT NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
ALTER TABLE [dbo].[Notifications] ADD CONSTRAINT [PK_Notifications] PRIMARY KEY CLUSTERED ([NotificationID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Notifications3] ON [dbo].[Notifications] ([NotificationEntered]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Notifications] ON [dbo].[Notifications] ([ProcessAfter]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_Notifications2] ON [dbo].[Notifications] ([ProcessStart]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Notifications] WITH NOCHECK ADD CONSTRAINT [FK_Notifications_Subscriptions] FOREIGN KEY ([SubscriptionID]) REFERENCES [dbo].[Subscriptions] ([SubscriptionID]) ON DELETE CASCADE
GO
GRANT REFERENCES ON [dbo].[Notifications] TO [RSExecRole]
GRANT SELECT ON [dbo].[Notifications] TO [RSExecRole]
GRANT INSERT ON [dbo].[Notifications] TO [RSExecRole]
GRANT DELETE ON [dbo].[Notifications] TO [RSExecRole]
GRANT UPDATE ON [dbo].[Notifications] TO [RSExecRole]
GO