[dbo].[DocumentAutoDownloadRuleDetailShipmentType]
CREATE TABLE [dbo].[DocumentAutoDownloadRuleDetailShipmentType]
(
[DocumentAutoDownloadRuleDetailShipmentTypeID] [int] NOT NULL IDENTITY(1, 1),
[DocumentAutoDownloadRuleDetailFID] [int] NOT NULL,
[ShipmentTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailShipmentType] ADD CONSTRAINT [PK_DocumentAutoDownloadRuleDetailShipmentType] PRIMARY KEY CLUSTERED ([DocumentAutoDownloadRuleDetailShipmentTypeID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailShipmentType_RuleDetail] ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] ([DocumentAutoDownloadRuleDetailFID], [ShipmentTypeFID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_DocumentAutoDownloadRuleDetailShipmentType_ShipmentType] ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] ([ShipmentTypeFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailShipmentType] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailShipmentType_DocumentAutoDownloadRuleDetail] FOREIGN KEY ([DocumentAutoDownloadRuleDetailFID]) REFERENCES [dbo].[DocumentAutoDownloadRuleDetail] ([DocumentAutoDownloadRuleDetailID]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[DocumentAutoDownloadRuleDetailShipmentType] ADD CONSTRAINT [FK_DocumentAutoDownloadRuleDetailShipmentType_ShipmentType] FOREIGN KEY ([ShipmentTypeFID]) REFERENCES [dbo].[ShipmentType] ([ShipmentTypeID]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] TO [MssExec]
GRANT INSERT ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] TO [MssExec]
GRANT DELETE ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] TO [MssExec]
GRANT UPDATE ON [dbo].[DocumentAutoDownloadRuleDetailShipmentType] TO [MssExec]
GO