CREATE TABLE [dbo].[harnotifylist]
(
[processobjid] [int] NOT NULL,
[parentprocobjid] [int] NULL,
[stateobjid] [int] NULL,
[isgroup] [char] (1) COLLATE SQL_Latin1_General_CP1_CS_AS NOT NULL,
[usrobjid] [int] NULL,
[usrgrpobjid] [int] NULL
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [baseidx_harnotifylist] ON [dbo].[harnotifylist] ([processobjid], [parentprocobjid], [stateobjid], [isgroup], [usrobjid], [usrgrpobjid]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [HARNOTIFYLIST_IND] ON [dbo].[harnotifylist] ([processobjid], [stateobjid], [parentprocobjid], [isgroup], [usrobjid], [usrgrpobjid]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [harnotifylist_spid_ind] ON [dbo].[harnotifylist] ([stateobjid], [processobjid]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [harnotifylist_usrgrp_ind] ON [dbo].[harnotifylist] ([usrgrpobjid]) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [harnotifylist_usrid_ind] ON [dbo].[harnotifylist] ([usrobjid]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[harnotifylist] ADD CONSTRAINT [HARNOTIFYLIST_PPID_FK] FOREIGN KEY ([parentprocobjid], [processobjid]) REFERENCES [dbo].[harlinkedprocess] ([parentprocobjid], [processobjid]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[harnotifylist] ADD CONSTRAINT [HARNOTIFYLIST_USRGRPID_FK] FOREIGN KEY ([usrgrpobjid]) REFERENCES [dbo].[harusergroup] ([usrgrpobjid]) ON DELETE CASCADE
GO
ALTER TABLE [dbo].[harnotifylist] ADD CONSTRAINT [HARNOTIFYLIST_USRID_FK] FOREIGN KEY ([usrobjid]) REFERENCES [dbo].[haruser] ([usrobjid]) ON DELETE CASCADE
GO
GRANT SELECT ON [dbo].[harnotifylist] TO [harvest_group]
GRANT INSERT ON [dbo].[harnotifylist] TO [harvest_group]
GRANT DELETE ON [dbo].[harnotifylist] TO [harvest_group]
GRANT UPDATE ON [dbo].[harnotifylist] TO [harvest_group]
GRANT SELECT ON [dbo].[harnotifylist] TO [harvest_rep]
GO