[dbo].[StoragePaymentTransactionTracking]
CREATE TABLE [dbo].[StoragePaymentTransactionTracking]
(
[StoragePaymentTransactionTrackingID] [int] NOT NULL IDENTITY(1, 1),
[StorageFID] [int] NOT NULL,
[InstrumentFID] [int] NOT NULL,
[FirstTransactionID] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[FirstTransactionUtcDate] [datetime] NOT NULL,
[LastTransactionID] [nvarchar] (64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[LastTransactionUtcDate] [datetime] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StoragePaymentTransactionTracking] ADD CONSTRAINT [PK_StoragePaymentTransactionTracking] PRIMARY KEY NONCLUSTERED ([StoragePaymentTransactionTrackingID]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StoragePaymentTransactionTracking_Instrument] ON [dbo].[StoragePaymentTransactionTracking] ([InstrumentFID]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_StoragePaymentTransactionTracking_Storage] ON [dbo].[StoragePaymentTransactionTracking] ([StorageFID], [InstrumentFID]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StoragePaymentTransactionTracking] ADD CONSTRAINT [FK_StoragePaymentTransactionTracking_Instrument] FOREIGN KEY ([InstrumentFID]) REFERENCES [dbo].[PlasticInstrument] ([InstrumentID])
GO
ALTER TABLE [dbo].[StoragePaymentTransactionTracking] ADD CONSTRAINT [FK_StoragePaymentTransactionTracking_Storage] FOREIGN KEY ([StorageFID]) REFERENCES [dbo].[Storage] ([StoragePriKey]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[StoragePaymentTransactionTracking] TO [MssExec]
GRANT INSERT ON [dbo].[StoragePaymentTransactionTracking] TO [MssExec]
GRANT DELETE ON [dbo].[StoragePaymentTransactionTracking] TO [MssExec]
GRANT UPDATE ON [dbo].[StoragePaymentTransactionTracking] TO [MssExec]
GO