[dbo].[DocumentAutoUploadRuleDetail]
CREATE TABLE [dbo].[DocumentAutoUploadRuleDetail]
(
[DocumentAutoUploadRuleDetailID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoUploadRuleFID] [int] NOT NULL,
[DocumentAutoUploadRuleItemFID] [int] NOT NULL,
[SortOrder] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetail] ADD CONSTRAINT [PK_DocumentAutoUploadRuleDetail] PRIMARY KEY CLUSTERED ([DocumentAutoUploadRuleDetailID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetail_Rule] ON [dbo].[DocumentAutoUploadRuleDetail] ([DocumentAutoUploadRuleFID], [SortOrder]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoUploadRuleDetail_Item] ON [dbo].[DocumentAutoUploadRuleDetail] ([DocumentAutoUploadRuleItemFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetail] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetail_DocumentAutoUploadRule] FOREIGN KEY ([DocumentAutoUploadRuleFID]) REFERENCES [dbo].[DocumentAutoUploadRule] ([DocumentAutoUploadRuleID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoUploadRuleDetail] ADD CONSTRAINT [FK_DocumentAutoUploadRuleDetail_DocumentAutoUploadRuleItem] FOREIGN KEY ([DocumentAutoUploadRuleItemFID]) REFERENCES [dbo].[DocumentAutoUploadRuleItem] ([DocumentAutoUploadRuleItemID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoUploadRuleDetail] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoUploadRuleDetail] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoUploadRuleDetail] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoUploadRuleDetail] TO [MssExec]
GO