[dbo].[ShipmentStatusFieldRequirement]
CREATE TABLE [dbo].[ShipmentStatusFieldRequirement]
(
[ShipmentStatusFieldRequirementID] [int] NOT NULL IDENTITY(1, 1),
[ShipmentStatusFieldRequirementMasterFID] [int] NOT NULL,
[ShipmentStatusFID] [int] NOT NULL,
[ShipmentTypeFID] [int] NULL,
[RequireableFieldFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ShipmentStatusFieldRequirement] ADD CONSTRAINT [PK_ShipmentStatusFieldRequirement] PRIMARY KEY NONCLUSTERED ([ShipmentStatusFieldRequirementID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_ShipmentStatusFieldRequirement_ShipmentStatusFID_ShipmentTypeFID_RequireableFieldFID] ON [dbo].[ShipmentStatusFieldRequirement] ([ShipmentStatusFID], [ShipmentTypeFID], [RequireableFieldFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ShipmentStatusFieldRequirement] ADD CONSTRAINT [FK_ShipmentStatusFieldRequirement_RequireableField] FOREIGN KEY ([RequireableFieldFID]) REFERENCES [dbo].[RequireableField] ([RequireableFieldID])
GO
ALTER TABLE [dbo].[ShipmentStatusFieldRequirement] ADD CONSTRAINT [FK_ShipmentStatusFieldRequirement_ShipmentStatus] FOREIGN KEY ([ShipmentStatusFID]) REFERENCES [dbo].[ShipmentStatus] ([ShipmentStatusID])
GO
ALTER TABLE [dbo].[ShipmentStatusFieldRequirement] ADD CONSTRAINT [FK_ShipmentStatusFieldRequirement_ShipmentStatusFieldRequirementMaster] FOREIGN KEY ([ShipmentStatusFieldRequirementMasterFID]) REFERENCES [dbo].[ShipmentStatusFieldRequirementMaster] ([ShipmentStatusFieldRequirementMasterID])
GO
ALTER TABLE [dbo].[ShipmentStatusFieldRequirement] ADD CONSTRAINT [FK_ShipmentStatusFieldRequirement_ShipmentType] FOREIGN KEY ([ShipmentTypeFID]) REFERENCES [dbo].[ShipmentType] ([ShipmentTypeID])
GO
GRANT SELECT ON [dbo].[ShipmentStatusFieldRequirement] TO [MssExec]
GRANT INSERT ON [dbo].[ShipmentStatusFieldRequirement] TO [MssExec]
GRANT DELETE ON [dbo].[ShipmentStatusFieldRequirement] TO [MssExec]
GRANT UPDATE ON [dbo].[ShipmentStatusFieldRequirement] TO [MssExec]
GO