[dbo].[DocumentAutoUploadRuleDetailDocumentType]
CREATE TABLE [dbo].[DocumentAutoUploadRuleDetailDocumentType]
(
[DocumentAutoUploadRuleDetailDocumentTypeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoUploadRuleDetailFID] [int] NOT NULL,
[DocumentTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailDocumentType] ADD CONSTRAINT [PK_DocumentAutoUploadRuleDetailDocumentType] PRIMARY KEY CLUSTERED ([DocumentAutoUploadRuleDetailDocumentTypeID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailDocumentType_RuleDetail] ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] ([DocumentAutoUploadRuleDetailFID], [DocumentTypeFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetailDocumentType_DocumentType] ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] ([DocumentTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailDocumentType] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailDocumentType_DocumentAutoUploadRuleDetail] FOREIGN KEY ([DocumentAutoUploadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoUploadRuleDetail] ([DocumentAutoUploadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetailDocumentType] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetailDocumentType_DocumentType] FOREIGN KEY ([DocumentTypeFID]) REFERENCES [dbo].[DocumentType] ([DocumentTypeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoUploadRuleDetailDocumentType] TO [MssExec]
GO