CREATE TABLE [dbo].[StorageActivity]
(
[StorageActivityPriKey] [int] NOT NULL IDENTITY(1, 1),
[StoragePriKey] [int] NULL,
[StorageItemsPriKey] [int] NULL,
[ActivityDescription] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[OldValue] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[NewValue] [varchar] (512) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SysuserPriKey] [int] NOT NULL,
[DateEntered] [datetime] NOT NULL,
[StorageActivityFieldTypeFID] [int] NOT NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageActivity] ADD CONSTRAINT [PK_StorageActivity] PRIMARY KEY NONCLUSTERED ([StorageActivityPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageActivity_StorageItemsPriKey] ON [dbo].[StorageActivity] ([StorageItemsPriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageActivity_StoragePriKey] ON [dbo].[StorageActivity] ([StoragePriKey]) WITH (FILLFACTOR=80) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_StorageActivity_SysuserPriKey] ON [dbo].[StorageActivity] ([SysuserPriKey]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[StorageActivity] ADD CONSTRAINT [FK_StorageActivity_StorageActivityFieldType] FOREIGN KEY ([StorageActivityFieldTypeFID]) REFERENCES [dbo].[StorageActivityFieldType] ([StorageActivityFieldTypeID])
GO
ALTER TABLE [dbo].[StorageActivity] ADD CONSTRAINT [FK_StorageActivity_StorageItems] FOREIGN KEY ([StorageItemsPriKey]) REFERENCES [dbo].[StorageItems] ([StorageItemsPriKey])
GO
ALTER TABLE [dbo].[StorageActivity] ADD CONSTRAINT [FK_StorageActivity_Storage] FOREIGN KEY ([StoragePriKey]) REFERENCES [dbo].[Storage] ([StoragePriKey])
GO
ALTER TABLE [dbo].[StorageActivity] ADD CONSTRAINT [FK_StorageActivity_Sysuser] FOREIGN KEY ([SysuserPriKey]) REFERENCES [dbo].[Sysuser] ([SysUserID])
GO
GRANT SELECT ON [dbo].[StorageActivity] TO [MssExec]
GRANT INSERT ON [dbo].[StorageActivity] TO [MssExec]
GRANT DELETE ON [dbo].[StorageActivity] TO [MssExec]
GRANT UPDATE ON [dbo].[StorageActivity] TO [MssExec]
GO
EXEC sp_addextendedproperty N'MS_Description', N'Description of the activity.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'ActivityDescription'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Date the change was made.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'DateEntered'
GO
EXEC sp_addextendedproperty N'MS_Description', N'New value.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'NewValue'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Previous value.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'OldValue'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Determines the type of data stored in the OldValue and NewValue fields.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'StorageActivityFieldTypeFID'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Primary key.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'StorageActivityPriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to a storage order.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'StoragePriKey'
GO
EXEC sp_addextendedproperty N'MS_Description', N'Foreign key to the user who made the change.', 'SCHEMA', N'dbo', 'TABLE', N'StorageActivity', 'COLUMN', N'SysuserPriKey'
GO