[dbo].[AdminHistoryRecord]
CREATE TABLE [dbo].[AdminHistoryRecord]
(
[AdminHistoryRecordId] [bigint] NOT NULL IDENTITY(1, 1),
[AdminHistoryAdminRoleFid] [int] NOT NULL,
[RecordId] [bigint] NOT NULL,
[RecordDescription] [nvarchar] (4000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminHistoryRecord] ADD CONSTRAINT [PK_AdminHistoryRecord] PRIMARY KEY CLUSTERED ([AdminHistoryRecordId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminHistoryRecord] ADD CONSTRAINT [IX_AdminHistoryRecord_AdminHistoryAdminRole_RecordId] UNIQUE NONCLUSTERED ([AdminHistoryAdminRoleFid], [RecordId]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_AdminHistoryRecord_AdminHistoryAdminRoleFid_RecordId_RecordDescription] ON [dbo].[AdminHistoryRecord] ([AdminHistoryAdminRoleFid], [RecordId], [RecordDescription]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_AdminHistoryRecord_AdminHistoryRecordId_RecordId] ON [dbo].[AdminHistoryRecord] ([AdminHistoryRecordId], [RecordId]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AdminHistoryRecord] ADD CONSTRAINT [FK_AdminHistoryRecord_AdminHistoryAdminRole] FOREIGN KEY ([AdminHistoryAdminRoleFid]) REFERENCES [dbo].[AdminHistoryAdminRole] ([AdminHistoryAdminRoleId])
GO
GRANT SELECT ON [dbo].[AdminHistoryRecord] TO [MssExec]
GRANT INSERT ON [dbo].[AdminHistoryRecord] TO [MssExec]
GRANT DELETE ON [dbo].[AdminHistoryRecord] TO [MssExec]
GRANT UPDATE ON [dbo].[AdminHistoryRecord] TO [MssExec]
GO