USE [Elyse_DB]
GO
/****** Object:  Table [user_restr].[controller_file_grp_sid_links]    Script Date: Sat 05-09-2026 7:01:54 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [user_restr].[controller_file_grp_sid_links](
	[controller_file_group_name_id] [bigint] NOT NULL,
	[sid_id] [bigint] NOT NULL,
	[created] [datetime2](7) NOT NULL,
	[granted_by] [nvarchar](128) NOT NULL,
	[valid_from] [datetime2](7) NULL,
	[valid_until] [datetime2](7) NULL,
	[notes] [nvarchar](1000) NULL,
	[app_reference] [nvarchar](1000) NULL,
 CONSTRAINT [PK_controller_file_grp_sid_links] PRIMARY KEY CLUSTERED 
(
	[controller_file_group_name_id] ASC,
	[sid_id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links] ADD  CONSTRAINT [DF_controller_file_grp_sid_links_created]  DEFAULT (sysdatetime()) FOR [created]
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links] ADD  CONSTRAINT [DF_controller_file_grp_sid_links_granted_by]  DEFAULT (original_login()) FOR [granted_by]
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links]  WITH CHECK ADD  CONSTRAINT [FK_controller_file_grp_sid_links_controller_file_grp_name_id] FOREIGN KEY([controller_file_group_name_id])
REFERENCES [xref].[controller_file_group_names] ([controller_file_group_name_id])
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links] CHECK CONSTRAINT [FK_controller_file_grp_sid_links_controller_file_grp_name_id]
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links]  WITH CHECK ADD  CONSTRAINT [FK_controller_file_grp_sid_links_sid_id] FOREIGN KEY([sid_id])
REFERENCES [user_restr].[sid_list] ([sid_id])
GO
ALTER TABLE [user_restr].[controller_file_grp_sid_links] CHECK CONSTRAINT [FK_controller_file_grp_sid_links_sid_id]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'This table assigns SIDs to controller file groups.  That is, file groups linked to file for which metadata editing has been restricted to individual controllers and can only be modified by an authoriser.  


COPYRIGHT NOTICE
This database schema and stored procedures are protected by copyright.
Copyright.  Silkwood Software Pty. Ltd. 2024' , @level0type=N'SCHEMA',@level0name=N'user_restr', @level1type=N'TABLE',@level1name=N'controller_file_grp_sid_links'
GO
