
[dbo].[DocumentAutoDownloadRuleDetailDocumentType]
CREATE TABLE [dbo].[DocumentAutoDownloadRuleDetailDocumentType]
(
[DocumentAutoDownloadRuleDetailDocumentTypeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoDownloadRuleDetailFID] [int] NOT NULL,
[DocumentTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailDocumentType] ADD CONSTRAINT [PK_DocumentAutoDownloadRuleDetailDocumentType] PRIMARY KEY CLUSTERED ([DocumentAutoDownloadRuleDetailDocumentTypeID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailDocumentType_RuleDetail] ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] ([DocumentAutoDownloadRuleDetailFID], [DocumentTypeFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailDocumentType_DocumentType] ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] ([DocumentTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailDocumentType] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailDocumentType_DocumentAutoDownloadRuleDetail] FOREIGN KEY ([DocumentAutoDownloadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoDownloadRuleDetail] ([DocumentAutoDownloadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailDocumentType] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailDocumentType_DocumentType] FOREIGN KEY ([DocumentTypeFID]) REFERENCES [dbo].[DocumentType] ([DocumentTypeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoDownloadRuleDetailDocumentType] TO [MssExec]
GO