CREATE TABLE [dbo].[POShipmentDetailSourceLinks]
(
[ShipmentDetailSourceLinkID] [int] NOT NULL IDENTITY(1, 1),
[ShipmentID] [int] NOT NULL,
[POShipmentDetailID] [int] NOT NULL,
[SourcePOShipmentDetailID] [int] NOT NULL,
[SourcePOShipmentDetailBinID] [int] NULL,
[QuantityReversed] [decimal] (18, 6) NOT NULL,
[CreateDate] [datetime] NOT NULL CONSTRAINT [DF_POShipmentDetailsourceLinks_CreateDate] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[POShipmentDetailSourceLinks] ADD CONSTRAINT [PK_POShipmentDetailSourceLinks] PRIMARY KEY CLUSTERED ([ShipmentDetailSourceLinkID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[POShipmentDetailSourceLinks] ADD CONSTRAINT [FK_POShipmentDetailSourceLinks_ShipmentID_POShipments] FOREIGN KEY ([ShipmentID]) REFERENCES [dbo].[POShipments] ([ShipmentID])
GO
ALTER TABLE [dbo].[POShipmentDetailSourceLinks] ADD CONSTRAINT [FK_POShipmentDetailSourceLinks_SourcePOShipmentDetailBinID_POShipmentDetailBins] FOREIGN KEY ([SourcePOShipmentDetailBinID]) REFERENCES [dbo].[POShipmentDetailBins] ([POShipmentDetailBinID])
GO
ALTER TABLE [dbo].[POShipmentDetailSourceLinks] ADD CONSTRAINT [FK_POShipmentDetailSourceLinks_SourcePOShipmentDetailID_POShipmentDetails] FOREIGN KEY ([SourcePOShipmentDetailID]) REFERENCES [dbo].[POShipmentDetails] ([POShipmentDetailID])
GO