USE [Elyse_DB]
GO
/****** Object:  Table [user_restr].[authorisation_fail_log]    Script Date: Sat 05-09-2026 8:34:58 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [user_restr].[authorisation_fail_log](
	[primary_key] [bigint] IDENTITY(1,1) NOT NULL,
	[date_time] [datetime2](7) NOT NULL,
	[username] [nvarchar](255) NOT NULL,
	[sid_id] [bigint] NULL,
	[sid] [varbinary](100) NOT NULL,
	[privilege_type] [nvarchar](50) NOT NULL,
	[privilege_id] [bigint] NULL,
	[privilege_name] [nvarchar](50) NULL,
	[stored_procedure] [nvarchar](80) NOT NULL,
	[failure_type] [nvarchar](1000) NULL,
 CONSTRAINT [PK_authorisation_fail_log] PRIMARY KEY CLUSTERED 
(
	[primary_key] 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].[authorisation_fail_log] ADD  CONSTRAINT [DF_authorisation_fail_log_date_time]  DEFAULT (sysdatetime()) FOR [date_time]
GO
ALTER TABLE [user_restr].[authorisation_fail_log] ADD  CONSTRAINT [DF_authorisation_fail_log_username]  DEFAULT (original_login()) FOR [username]
GO
ALTER TABLE [user_restr].[authorisation_fail_log] ADD  CONSTRAINT [DF_authorisation_fail_log_sid]  DEFAULT (suser_sid(original_login())) FOR [sid]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'Records failed authorisation attempts. 

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