CREATE TABLE [dbo].[StorageDeferral]
(
[DeferralPriKey] [int] NOT NULL IDENTITY(1, 1),
[BMinPriKey] [int] NOT NULL,
[RevenueEarned] [datetime] NOT NULL,
[Processed] [datetime] NULL,
[ProcessedBy] [int] NULL,
[StorageItemsPriKey] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageDeferral] ADD CONSTRAINT [PK_StorageDeferral] PRIMARY KEY NONCLUSTERED ([DeferralPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageDeferral_BillingMinorItem] ON [dbo].[StorageDeferral] ([BMinPriKey]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageDeferral_ProcessedBy] ON [dbo].[StorageDeferral] ([ProcessedBy]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageDeferral_StorageItemsPriKey] ON [dbo].[StorageDeferral] ([StorageItemsPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageDeferral] ADD CONSTRAINT [FK_StorageDeferral_BillingMinorItem] FOREIGN KEY ([BMinPriKey]) REFERENCES [dbo].[BillingMinorItem] ([BMinPriKey])
GO
ALTER TABLE [dbo].[StorageDeferral] ADD CONSTRAINT [FK_StorageDeferral_Sysuser] FOREIGN KEY ([ProcessedBy]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
ALTER TABLE [dbo].[StorageDeferral] ADD CONSTRAINT [FK_StorageDeferral_StorageItems] FOREIGN KEY ([StorageItemsPriKey]) REFERENCES [dbo].[StorageItems] ([StorageItemsPriKey])
GO
GRANT SELECT ON [dbo].[StorageDeferral] TO [MssExec]
GRANT INSERT ON [dbo].[StorageDeferral] TO [MssExec]
GRANT DELETE ON [dbo].[StorageDeferral] TO [MssExec]
GRANT UPDATE ON [dbo].[StorageDeferral] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to a revenue item.', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'BMinPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'DeferralPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The date the deferred storage was processed.', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'Processed'
GO
EXEC sp_addextendedproperty N'MS_Description', N'The person who processed the deferred storage.', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'ProcessedBy'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date the deferred moves to a revenue account.', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'RevenueEarned'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to a stoage item.', 'SCHEMA', N'dbo', 'TABLE', N'StorageDeferral', 'COLUMN', N'StorageItemsPriKey'
GO