CREATE TABLE rustici_property (name nvarchar(48) NOT NULL, display_order numeric(8, 0) NOT NULL, rustici_prop_group_name nvarchar(85) NOT NULL, render_type nvarchar(16) NOT NULL, render_attributes nvarchar(4000))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.rustici_property';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Rustici property definitions';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property'; DECLARE @ColumnName SYSNAME set @ColumnName = N'name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Rustici property name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_order'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Display rendering order within the group (0=highest)';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property'; DECLARE @ColumnName SYSNAME set @ColumnName = N'rustici_prop_group_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Group this property definition belongs in';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property'; DECLARE @ColumnName SYSNAME set @ColumnName = N'render_type'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Internal LMS Rendering type';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property'; DECLARE @ColumnName SYSNAME set @ColumnName = N'render_attributes'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Internal LMS definition of attributes for the rendering type';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE rustici_property ADD CONSTRAINT pk_rustici_property PRIMARY KEY (name)
GO

CREATE TABLE rustici_property_group (name nvarchar(128) NOT NULL, display_order numeric(8, 0) NOT NULL)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property_group'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.rustici_property_group';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Rustici property group';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property_group'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property_group'; DECLARE @ColumnName SYSNAME set @ColumnName = N'name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Will used rustici+_+[this.name] label for display';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'rustici_property_group'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.rustici_property_group'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_order'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Display rendering order for the group (0=highest)';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE rustici_property_group ADD CONSTRAINT pk_rustici_propgrp PRIMARY KEY (name)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20210914-ct-4', 'craig.taylor', 'nschema/2111.changeLog.xml', GETDATE(), 814, '8:379dd879512ddf2126d053767e34424a', 'createTable tableName=rustici_property; addPrimaryKey constraintName=pk_rustici_property, tableName=rustici_property; createTable tableName=rustici_property_group; addPrimaryKey constraintName=pk_rustici_propgrp, tableName=rustici_property_group', 'PL-2355: Rustici property settings', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2111.changeLog.xml::20210929-js-1::michael.gorohov
-- Add account_type and content_connector_prefix columns to the olsa_account table
ALTER TABLE olsa_account ADD account_type nvarchar(127) CONSTRAINT DF_olsa_account_account_type DEFAULT 'Skillsoft' NOT NULL
GO

ALTER TABLE olsa_account ADD content_connector_prefix nvarchar(127)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'olsa_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.olsa_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'account_type'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Used to specify Web Catalog''s accout type';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'olsa_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.olsa_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'content_connector_prefix'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Used to specify Content Connector''s prefix';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20210929-js-1', 'michael.gorohov', 'nschema/2111.changeLog.xml', GETDATE(), 815, '8:6697a22fae5498d0570cc1cd5e41b93c', 'addColumn tableName=olsa_account', 'Add account_type and content_connector_prefix columns to the olsa_account table', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2111.changeLog.xml::20211004-ct-4::craig.taylor
INSERT INTO rustici_property_group (name, display_order) VALUES ('launchSettings', '1')
GO

INSERT INTO rustici_property_group (name, display_order) VALUES ('navigationSettings', '2')
GO

INSERT INTO rustici_property_group (name, display_order) VALUES ('compatibilitySettings', '3')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type, render_attributes) VALUES ('PlayerScoLaunchType', '1', 'launchSettings', 'selector', 'FRAMESET,NEW_WINDOW,NEW_WINDOW_AFTER_CLICK,NEW_WINDOW_WITHOUT_BROWSER_TOOLBAR,NEW_WINDOW_AFTER_CLICK_WITHOUT_BROWSER_TOOLBAR')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type, render_attributes) VALUES ('PlayerLaunchType', '2', 'launchSettings', 'selector', 'FRAMESET,NEW_WINDOW,NEW_WINDOW_AFTER_CLICK,NEW_WINDOW_WITHOUT_BROWSER_TOOLBAR,NEW_WINDOW_AFTER_CLICK_WITHOUT_BROWSER_TOOLBAR')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerShowFinishButton', '1', 'navigationSettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerShowNavBar', '2', 'navigationSettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerWrapScoWindowWithApi', '1', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type, render_attributes) VALUES ('PlayerFinishCausesImmediateCommit', '2', 'compatibilitySettings', 'boolean', '')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerValidateInteractionResponses', '3', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerScoreOverridesStatus', '4', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerScaleRawScore', '5', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerRollupEmptySetToUnknown', '6', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type, render_attributes) VALUES ('PlayerReturnToLmsAction', '7', 'compatibilitySettings', 'selector', 'Legacy,SuspendAll,ExitAll,Selectable')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerRollupRuntimeAtScoUnload', '8', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerForceObjectiveCompletionSetByContent', '9', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerInvokeRollupAtSuspendAll', '10', 'compatibilitySettings', 'boolean')
GO

INSERT INTO rustici_property (name, display_order, rustici_prop_group_name, render_type) VALUES ('PlayerSuspendDataMaxLength', '11', 'compatibilitySettings', 'text')
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211004-ct-4', 'craig.taylor', 'nschema/2111.changeLog.xml', GETDATE(), 816, '8:648a5922fdb50ee172d47210c45286a4', 'insert tableName=rustici_property_group; insert tableName=rustici_property_group; insert tableName=rustici_property_group; insert tableName=rustici_property; insert tableName=rustici_property; insert tableName=rustici_property; insert tableName=ru...', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2203.changeLog.xml::20211028-sc-1::shu.cui
UPDATE ekpversion SET dblevel = 2203, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211028-sc-1', 'shu.cui', 'nschema/2203.changeLog.xml', GETDATE(), 817, '8:155407162ebe8334947378a6efd34cee', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2203.changeLog.xml::20211210-em-1::emmar.masagca
-- PL-2823 Apply recommended Indexes to 22.03
CREATE NONCLUSTERED INDEX IDX_courseid_eventid ON currcourses(courseid, eventid)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211210-em-1', 'emmar.masagca', 'nschema/2203.changeLog.xml', GETDATE(), 818, '8:8f4a756d37eea1d1580319814f38f903', 'createIndex indexName=IDX_courseid_eventid, tableName=currcourses', 'PL-2823 Apply recommended Indexes to 22.03', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2203.changeLog.xml::20211210-em-2::emmar.masagca
-- PL-2823 Apply recommended Indexes to 22.03
CREATE NONCLUSTERED INDEX NUK_currcourses_required ON currcourses(required)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211210-em-2', 'emmar.masagca', 'nschema/2203.changeLog.xml', GETDATE(), 819, '8:08d3df707fe58d236ce4a03cd7256c32', 'createIndex indexName=NUK_currcourses_required, tableName=currcourses', 'PL-2823 Apply recommended Indexes to 22.03', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2203.changeLog.xml::20211210-em-3::emmar.masagca
-- PL-2823 Apply recommended Indexes to 22.03
CREATE NONCLUSTERED INDEX NUK_auditobj_action_type_id
            ON auditobjects (action, objecttype, objectid)
            INCLUDE (actiontime)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211210-em-3', 'emmar.masagca', 'nschema/2203.changeLog.xml', GETDATE(), 820, '8:d9b0b568dac63b444118869eadb5e92c', 'sql', 'PL-2823 Apply recommended Indexes to 22.03', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2203.changeLog.xml::20211210-em-4::emmar.masagca
-- PL-2823 Apply recommended Indexes to 22.03
CREATE NONCLUSTERED INDEX NUK_tran_eid_currid_status
            ON transcript (eventid,currid,studentstatus)
            INCLUDE (confirmation_status,
            completion_deadline,allowDappraiserAssess,allowSupervisorAssess,
            student_substatus,bundle_id,reserve_seat)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20211210-em-4', 'emmar.masagca', 'nschema/2203.changeLog.xml', GETDATE(), 821, '8:833edabfad0d3a199e73946eab6953d3', 'sql', 'PL-2823 Apply recommended Indexes to 22.03', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/liquibase.quartz.init.xml::quartz-init::quartz
CREATE TABLE QRTZ_LOCKS (SCHED_NAME varchar(120) NOT NULL, LOCK_NAME varchar(40) NOT NULL)
GO

ALTER TABLE QRTZ_LOCKS ADD PRIMARY KEY (SCHED_NAME, LOCK_NAME)
GO

CREATE TABLE QRTZ_FIRED_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, ENTRY_ID varchar(95) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, INSTANCE_NAME varchar(200) NOT NULL, FIRED_TIME bigint NOT NULL, SCHED_TIME bigint NOT NULL, PRIORITY int NOT NULL, STATE varchar(16) NOT NULL, JOB_NAME varchar(200), JOB_GROUP varchar(200), IS_NONCONCURRENT bit, REQUESTS_RECOVERY bit)
GO

ALTER TABLE QRTZ_FIRED_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, ENTRY_ID)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_INST_JOB_REQ_RCVRY ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, INSTANCE_NAME, REQUESTS_RECOVERY)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_J_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, JOB_NAME, JOB_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_JG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, JOB_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_T_G ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_TG ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, TRIGGER_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_FT_TRIG_INST_NAME ON QRTZ_FIRED_TRIGGERS(SCHED_NAME, INSTANCE_NAME)
GO

CREATE TABLE QRTZ_CALENDARS (SCHED_NAME varchar(120) NOT NULL, CALENDAR_NAME varchar(200) NOT NULL, CALENDAR varbinary(MAX) NOT NULL)
GO

ALTER TABLE QRTZ_CALENDARS ADD PRIMARY KEY (SCHED_NAME, CALENDAR_NAME)
GO

CREATE TABLE QRTZ_PAUSED_TRIGGER_GRPS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL)
GO

ALTER TABLE QRTZ_PAUSED_TRIGGER_GRPS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_GROUP)
GO

CREATE TABLE QRTZ_SCHEDULER_STATE (SCHED_NAME varchar(120) NOT NULL, INSTANCE_NAME varchar(200) NOT NULL, LAST_CHECKIN_TIME bigint NOT NULL, CHECKIN_INTERVAL bigint NOT NULL)
GO

ALTER TABLE QRTZ_SCHEDULER_STATE ADD PRIMARY KEY (SCHED_NAME, INSTANCE_NAME)
GO

CREATE TABLE QRTZ_JOB_DETAILS (SCHED_NAME varchar(120) NOT NULL, JOB_NAME varchar(200) NOT NULL, JOB_GROUP varchar(200) NOT NULL, DESCRIPTION varchar(250), JOB_CLASS_NAME varchar(250) NOT NULL, IS_DURABLE bit NOT NULL, IS_NONCONCURRENT bit NOT NULL, IS_UPDATE_DATA bit NOT NULL, REQUESTS_RECOVERY bit NOT NULL, JOB_DATA varbinary(MAX))
GO

ALTER TABLE QRTZ_JOB_DETAILS ADD PRIMARY KEY (SCHED_NAME, JOB_NAME, JOB_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_J_GRP ON QRTZ_JOB_DETAILS(SCHED_NAME, JOB_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_J_REQ_RECOVERY ON QRTZ_JOB_DETAILS(SCHED_NAME, REQUESTS_RECOVERY)
GO

CREATE TABLE QRTZ_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, JOB_NAME varchar(200) NOT NULL, JOB_GROUP varchar(200) NOT NULL, DESCRIPTION varchar(250), NEXT_FIRE_TIME bigint, PREV_FIRE_TIME bigint, PRIORITY int, TRIGGER_STATE varchar(16) NOT NULL, TRIGGER_TYPE varchar(8) NOT NULL, START_TIME bigint NOT NULL, END_TIME bigint, CALENDAR_NAME varchar(200), MISFIRE_INSTR smallint, JOB_DATA varbinary(MAX))
GO

ALTER TABLE QRTZ_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_C ON QRTZ_TRIGGERS(SCHED_NAME, CALENDAR_NAME)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_G ON QRTZ_TRIGGERS(SCHED_NAME, TRIGGER_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_JG ON QRTZ_TRIGGERS(SCHED_NAME, JOB_GROUP)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_N_G_STATE ON QRTZ_TRIGGERS(SCHED_NAME, TRIGGER_GROUP, TRIGGER_STATE)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_N_STATE ON QRTZ_TRIGGERS(SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_STATE)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_NEXT_FIRE_TIME ON QRTZ_TRIGGERS(SCHED_NAME, NEXT_FIRE_TIME)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_NFT_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_NFT_ST ON QRTZ_TRIGGERS(SCHED_NAME, TRIGGER_STATE, NEXT_FIRE_TIME)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_NFT_ST_MISFIRE ON QRTZ_TRIGGERS(SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_STATE)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_NFT_ST_MISFIRE_GRP ON QRTZ_TRIGGERS(SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_GROUP, TRIGGER_STATE)
GO

CREATE NONCLUSTERED INDEX IDX_QRTZ_T_STATE ON QRTZ_TRIGGERS(SCHED_NAME, TRIGGER_STATE)
GO

CREATE TABLE QRTZ_BLOB_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, BLOB_DATA varbinary(MAX))
GO

ALTER TABLE QRTZ_BLOB_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

CREATE TABLE QRTZ_SIMPROP_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, STR_PROP_1 varchar(512), STR_PROP_2 varchar(512), STR_PROP_3 varchar(512), INT_PROP_1 int, INT_PROP_2 int, LONG_PROP_1 bigint, LONG_PROP_2 bigint, DEC_PROP_1 numeric(13, 4), DEC_PROP_2 numeric(13, 4), BOOL_PROP_1 bit, BOOL_PROP_2 bit)
GO

ALTER TABLE QRTZ_SIMPROP_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

CREATE TABLE QRTZ_CRON_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, CRON_EXPRESSION varchar(120) NOT NULL, TIME_ZONE_ID varchar(80))
GO

ALTER TABLE QRTZ_CRON_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

CREATE TABLE QRTZ_SIMPLE_TRIGGERS (SCHED_NAME varchar(120) NOT NULL, TRIGGER_NAME varchar(200) NOT NULL, TRIGGER_GROUP varchar(200) NOT NULL, REPEAT_COUNT bigint NOT NULL, REPEAT_INTERVAL bigint NOT NULL, TIMES_TRIGGERED bigint NOT NULL)
GO

ALTER TABLE QRTZ_SIMPLE_TRIGGERS ADD PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

ALTER TABLE QRTZ_TRIGGERS ADD CONSTRAINT QRTZ_TRIGGERS_FK FOREIGN KEY (SCHED_NAME, JOB_NAME, JOB_GROUP) REFERENCES QRTZ_JOB_DETAILS (SCHED_NAME, JOB_NAME, JOB_GROUP)
GO

ALTER TABLE QRTZ_SIMPLE_TRIGGERS ADD CONSTRAINT QRTZ_SIMPLE_TRIGGERS_FK FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

ALTER TABLE QRTZ_CRON_TRIGGERS ADD CONSTRAINT QRTZ_CRON_TRIGGERS_FK FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

ALTER TABLE QRTZ_SIMPROP_TRIGGERS ADD CONSTRAINT QRTZ_SIMPROP_TRIGGERS_FK FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

ALTER TABLE QRTZ_BLOB_TRIGGERS ADD CONSTRAINT QRTZ_BLOB_TRIGGERS_FK FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP) REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('quartz-init', 'quartz', 'nschema/liquibase.quartz.init.xml', GETDATE(), 822, '8:a2fc1f56380aaa7ff4a1ac97105c7fb8', 'createTable tableName=QRTZ_LOCKS; addPrimaryKey tableName=QRTZ_LOCKS; createTable tableName=QRTZ_FIRED_TRIGGERS; addPrimaryKey tableName=QRTZ_FIRED_TRIGGERS; createIndex indexName=IDX_QRTZ_FT_INST_JOB_REQ_RCVRY, tableName=QRTZ_FIRED_TRIGGERS; crea...', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220228-em-1::emmar.masagca
UPDATE ekpversion SET dblevel = 2207, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220228-em-1', 'emmar.masagca', 'nschema/2207.changeLog.xml', GETDATE(), 823, '8:5b9cb885e6b67b28e68c99bc717cc734', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220318-en-1::eddie.ng
-- PL-3097 Create Job Profile Assignment Type table
CREATE TABLE job_profile_assignment_type (id nvarchar(15) NOT NULL, code nvarchar(255) NOT NULL, display_name nvarchar(255), CONSTRAINT PK_JP_ASSIGNMENT_TYPE PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_assignment_type'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_assignment_type'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assignment Type ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_assignment_type'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_assignment_type'; DECLARE @ColumnName SYSNAME set @ColumnName = N'code'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assignment Type Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_assignment_type'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_assignment_type'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assignment Type Display Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220318-en-1', 'eddie.ng', 'nschema/2207.changeLog.xml', GETDATE(), 824, '8:12459127b906dd15132daa136c8f291e', 'createTable tableName=job_profile_assignment_type', 'PL-3097 Create Job Profile Assignment Type table', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220318-en-2::eddie.ng
-- PL-3097 Add Assignment Type ID column to table user_job_profile
ALTER TABLE user_job_profile ADD assignment_type_id nvarchar(15)
GO

ALTER TABLE user_job_profile ADD CONSTRAINT FK_JP_ASSIGNMENT_TYPE_ID FOREIGN KEY (assignment_type_id) REFERENCES job_profile_assignment_type (id)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_job_profile'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_job_profile'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assignment_type_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assignment Type ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220318-en-2', 'eddie.ng', 'nschema/2207.changeLog.xml', GETDATE(), 825, '8:54354ac1a8ae4d860a7d4e7dc8f5d15f', 'addColumn tableName=user_job_profile', 'PL-3097 Add Assignment Type ID column to table user_job_profile', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220401-em-1::emmar.masagca
ALTER TABLE job_profile_assignment_type ADD CONSTRAINT UK_JP_ASSIGNMENT_TYPE_CODE UNIQUE (code)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220401-em-1', 'emmar.masagca', 'nschema/2207.changeLog.xml', GETDATE(), 826, '8:9c03bf6f868733217a6e97d7b2815f00', 'addUniqueConstraint constraintName=UK_JP_ASSIGNMENT_TYPE_CODE, tableName=job_profile_assignment_type', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220516-en-1::eddie.ng
-- PL-2734 Job Profile image
ALTER TABLE job_profile ADD picture nvarchar(255)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile'; DECLARE @ColumnName SYSNAME set @ColumnName = N'picture'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Picture';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220516-en-1', 'eddie.ng', 'nschema/2207.changeLog.xml', GETDATE(), 827, '8:d4c58e15d90ff0fb642164331a887c04', 'addColumn tableName=job_profile', 'PL-2734 Job Profile image', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2207.changeLog.xml::20220525-sc-1::shu.cui
-- NSD-6168 add check for n_completions_required > 0
UPDATE individual_competency SET n_completions_required = 1 WHERE n_completions_required=0
GO

DECLARE @sql [nvarchar](MAX)
SELECT @sql = N'ALTER TABLE individual_competency DROP CONSTRAINT ' + QUOTENAME([df].[name]) FROM [sys].[columns] AS [c] INNER JOIN [sys].[default_constraints] AS [df] ON [df].[object_id] = [c].[default_object_id] WHERE [c].[object_id] = OBJECT_ID(N'individual_competency') AND [c].[name] = N'n_completions_required'
EXEC sp_executesql @sql
GO

ALTER TABLE individual_competency ADD CONSTRAINT DF_individual_competency_n_completions_required DEFAULT 1 FOR n_completions_required
GO

ALTER TABLE individual_competency ADD CHECK (n_completions_required > 0)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220525-sc-1', 'shu.cui', 'nschema/2207.changeLog.xml', GETDATE(), 828, '8:dc42810dfc068db33b56fc40c424cc7e', 'update tableName=individual_competency; dropDefaultValue columnName=n_completions_required, tableName=individual_competency; addDefaultValue columnName=n_completions_required, tableName=individual_competency; sql', 'NSD-6168 add check for n_completions_required > 0', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220623-ps-1::paul.strugnell
UPDATE ekpversion SET dblevel = 2211, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220623-ps-1', 'paul.strugnell', 'nschema/2211.changeLog.xml', GETDATE(), 829, '8:e6ceeceebd8ead1bd34e6b95d24b7557', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220725-yf-1::yueqin.feng
-- PL-3819: New email notification - Exam Passed
ALTER TABLE mastertest ADD pass_email_id nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'pass_email_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The ID of the email template that will be sent to the user if the user passes this test.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220725-yf-1', 'yueqin.feng', 'nschema/2211.changeLog.xml', GETDATE(), 830, '8:cc406d929ec46be832345f8f0bad9fa0', 'addColumn tableName=mastertest', 'PL-3819: New email notification - Exam Passed', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::22020726-jw-1::Justin.wang
-- PLC-3: Update Job Profile Editor - Job Profile Dates(start and end ) for assign Job Profile in DB
ALTER TABLE job_profile ADD allows_assignment_start_date datetime
GO

ALTER TABLE job_profile ADD allows_assignment_end_date datetime
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile'; DECLARE @ColumnName SYSNAME set @ColumnName = N'allows_assignment_start_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This is the date a Job Profile after which will be available for users to self-assign or reviewer-assign, as well as for the system to automatically assign';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile'; DECLARE @ColumnName SYSNAME set @ColumnName = N'allows_assignment_end_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'After this date the Job Profile will no longer be available for users to self-assign or reviewer-assign, as well as no longer automatically assign';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('22020726-jw-1', 'Justin.wang', 'nschema/2211.changeLog.xml', GETDATE(), 831, '8:64ed897d8655fffecb3d7cfaa0ca4133', 'addColumn tableName=job_profile', 'PLC-3: Update Job Profile Editor - Job Profile Dates(start and end ) for assign Job Profile in DB', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220802-yf-1::yueqin.feng
-- PL-3820: New email notification - Exam Ready to be Graded
ALTER TABLE mastertest ADD grade_notif_email_id nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'grade_notif_email_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The ID of the email template that will be sent to the user if the test instance is ready to be graded.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220802-yf-1', 'yueqin.feng', 'nschema/2211.changeLog.xml', GETDATE(), 832, '8:14ad318d91b9424d95512308c2154c0d', 'addColumn tableName=mastertest', 'PL-3820: New email notification - Exam Ready to be Graded', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220805-yf-1::yueqin.feng
-- PL-3608: Designate an Assignment Type via the Job Profile Auto-Assign screen
ALTER TABLE jobprofile_autoenroll ADD assignment_type_id nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'jobprofile_autoenroll'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.jobprofile_autoenroll'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assignment_type_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Job Profile Assignment Type ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220805-yf-1', 'yueqin.feng', 'nschema/2211.changeLog.xml', GETDATE(), 833, '8:0be97f433b302be204d4a9bb91d94f55', 'addColumn tableName=jobprofile_autoenroll', 'PL-3608: Designate an Assignment Type via the Job Profile Auto-Assign screen', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220815-rl-1::richard.li
-- PLC-40 Add Quota column to Job Profile Competency table
ALTER TABLE job_profile_competency ADD competency_quota smallint
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_competency'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_competency'; DECLARE @ColumnName SYSNAME set @ColumnName = N'competency_quota'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Competency Quota';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220815-rl-1', 'richard.li', 'nschema/2211.changeLog.xml', GETDATE(), 834, '8:b18a0bafa51ecf2a6492b065f86b2da7', 'addColumn tableName=job_profile_competency', 'PLC-40 Add Quota column to Job Profile Competency table', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220902-rl-1::richard.li
-- PLC-21 Create Job Profile - Job Profile Groups view
CREATE VIEW job_profile_group_vw AS SELECT
            jpg.id AS job_profile_group_id,
            jpg.name,
            jpg.poolid,
            jpg.description,
            jpg.is_active,
            jpg.reference_code,
            jpg.categoryid,
            jpg.certid,
            jpgm.job_profile_id
            FROM job_profile_group jpg
            INNER JOIN job_profile_group_map jpgm ON jpg.id = jpgm.job_profile_group_id
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220902-rl-1', 'richard.li', 'nschema/2211.changeLog.xml', GETDATE(), 835, '8:ab0e24e73f2d241c636e9c10cd532ea2', 'createView viewName=job_profile_group_vw', 'PLC-21 Create Job Profile - Job Profile Groups view', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20220924-vl-1::vincy.liu
-- PLC-30 Add Competency Quota and Job Profile Groups code and name in R116
DROP VIEW user_job_profile_competency_vw
GO

CREATE VIEW user_job_profile_competency_vw AS SELECT
            ujp.user_id,
            jp.id AS job_profile_id,
            jp.name AS job_profile_name,
            c.name,
            rl.level_order,
            jpcrl.level_order AS target_level_order,
            uc.assessment_mode,
            uc.assigned_by,
            uc.assigned_comment,
            jpc.competency_id,
            jpc.competency_quota,
            uc.competency_level_id,
            uc.date_assigned,
            rl.level_order - jpcrl.level_order AS gap,
            CASE
            WHEN rl.level_order IS NULL THEN 'N'
            WHEN jpcrl.level_order > rl.level_order THEN 'N'
            ELSE 'Y'
            END AS met,
            rl.code AS level_code,
            jpcrl.code AS target_level_code,
            jpc.competency_order,
            c.acquire_method,
            c.requires_all,
            c.n_completions_required,
            c.reference_code,
            c.description
            FROM user_job_profile ujp
            LEFT OUTER JOIN job_profile_competency jpc
            ON ujp.job_profile_id = jpc.job_profile_id
            LEFT OUTER JOIN user_competency uc
            ON jpc.competency_id = uc.competency_id AND ujp.user_id = uc.user_id
            LEFT OUTER JOIN competency_level cl
            ON cl.id = uc.competency_level_id
            LEFT OUTER JOIN tms_responsibility_level rl
            ON cl.res_id = rl.id
            LEFT OUTER JOIN competency_level jpcl
            ON jpcl.id = jpc.competency_target_level_id
            LEFT OUTER JOIN tms_responsibility_level jpcrl
            ON jpcrl.id = jpcl.res_id,
            individual_competency c, job_profile jp
            WHERE jp.id = ujp.job_profile_id
            AND jpc.job_profile_id = ujp.job_profile_id
            AND jpc.competency_id = c.id
            AND c.id = jpc.competency_id
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20220924-vl-1', 'vincy.liu', 'nschema/2211.changeLog.xml', GETDATE(), 836, '8:fac383500d01f6368ab053227d6dea11', 'dropView viewName=user_job_profile_competency_vw; createView viewName=user_job_profile_competency_vw', 'PLC-30 Add Competency Quota and Job Profile Groups code and name in R116', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20221018-en-1::eddie.ng
-- PL-3811 Add included columns to index in resource_string
DROP INDEX nuk_res_string_bundle_id ON resource_string
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20221018-en-1', 'eddie.ng', 'nschema/2211.changeLog.xml', GETDATE(), 837, '8:a4aca7ef3cee6d28119f5b355b780097', 'dropIndex indexName=nuk_res_string_bundle_id, tableName=resource_string', 'PL-3811 Add included columns to index in resource_string', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2211.changeLog.xml::20221018-en-2::eddie.ng
-- PL-3811 Add included columns to index in resource_string
CREATE NONCLUSTERED INDEX nuk_res_string_bundle_id
            ON resource_string (bundle_id)
            INCLUDE (id, value_varchar, value_ntext, reference_id, field)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20221018-en-2', 'eddie.ng', 'nschema/2211.changeLog.xml', GETDATE(), 838, '8:81298f4a1bfd1e4c9429ac7ba9faf880', 'sql', 'PL-3811 Add included columns to index in resource_string', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2303.changeLog.xml::20221103-sc-1::shu.cui
UPDATE ekpversion SET dblevel = 2303, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20221103-sc-1', 'shu.cui', 'nschema/2303.changeLog.xml', GETDATE(), 839, '8:31069739df2d7447191758e40836b705', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2303.changeLog.xml::20221117-mg-1::michael.gorohov
-- PL-1869 unutilized indexes came as part of index analysis report from dba
DROP INDEX NUK_CERT_SCHEDULE_DATE ON cert_schedule
GO

DROP INDEX NUK_COMP_AP_Q_OWNER ON comp_approval_queue
GO

DROP INDEX NUK_CO_LOID ON ContentOrganization
GO

DROP INDEX nuk_eval_event ON evaluation
GO

DROP INDEX NUK_PAYMENT_X1 ON payment
GO

DROP INDEX NUK_PAYMENT_X2 ON payment
GO

DROP INDEX NUK_PERMISSION_TEMPLATE_HASH ON permission_template
GO

DROP INDEX NUK_TRAN_HIST_LID_SID ON transcript_history
GO

DROP INDEX NUK_TRANS_STATLOG_LOGDATE ON transcript_stat_log
GO

DROP INDEX NUK_GTT_ORGANIZER ON vc_gtt_organizer
GO

DROP INDEX IF EXISTS [NUK_OTHER_LTYPE] ON [dbo].[otherObjects]
GO

DROP INDEX IF EXISTS [NUK_USERS_L123] ON [dbo].[users_assignment]
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20221117-mg-1', 'michael.gorohov', 'nschema/2303.changeLog.xml', GETDATE(), 840, '8:89f5205e1ec019328d7136830dbd6946', 'dropIndex indexName=NUK_CERT_SCHEDULE_DATE, tableName=cert_schedule; dropIndex indexName=NUK_COMP_AP_Q_OWNER, tableName=comp_approval_queue; dropIndex indexName=NUK_CO_LOID, tableName=ContentOrganization; dropIndex indexName=nuk_eval_event, tableN...', 'PL-1869 unutilized indexes came as part of index analysis report from dba', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2303.changeLog.xml::20221130-sk-1::sachin.kumar
-- PL-4425 Allow the currentPID to be 255 characters in length
ALTER TABLE users_meta ALTER COLUMN currentPID nvarchar(255)
GO

ALTER TABLE users_assignment ALTER COLUMN assignment_ref_code nvarchar(425)
GO

ALTER TABLE user_merge_history ALTER COLUMN actor_currentpid nvarchar(255)
GO

ALTER TABLE user_merge_history ALTER COLUMN source_currentpid nvarchar(255)
GO

ALTER TABLE user_merge_history ALTER COLUMN target_currentpid nvarchar(255)
GO

ALTER TABLE stats_overall ALTER COLUMN creator_pid nvarchar(255)
GO

ALTER TABLE auditobjects ALTER COLUMN objectid nvarchar(255)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20221130-sk-1', 'sachin.kumar', 'nschema/2303.changeLog.xml', GETDATE(), 841, '8:5070952afbe0787e53ea6ea34536de8c', 'modifyDataType columnName=currentPID, tableName=users_meta; modifyDataType columnName=assignment_ref_code, tableName=users_assignment; modifyDataType columnName=actor_currentpid, tableName=user_merge_history; modifyDataType columnName=source_curre...', 'PL-4425 Allow the currentPID to be 255 characters in length', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230220-yf-1::yueqin.feng
UPDATE ekpversion SET dblevel = 2307, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230220-yf-1', 'yueqin.feng', 'nschema/2307.changeLog.xml', GETDATE(), 842, '8:ac7a25a536fb61a2d4e6e42ce5a2878f', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230307-sc-1::shu.cui
-- PL-5077 Create table to store scheduled task history
CREATE TABLE scheduled_task_log (task_name nvarchar(85) NOT NULL, status char(1) NOT NULL, message nvarchar (max), start_time datetime NOT NULL, end_time datetime)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'scheduled_task_log'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.scheduled_task_log'; DECLARE @ColumnName SYSNAME set @ColumnName = N'task_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Scheduled Task Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'scheduled_task_log'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.scheduled_task_log'; DECLARE @ColumnName SYSNAME set @ColumnName = N'status'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Job Status';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'scheduled_task_log'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.scheduled_task_log'; DECLARE @ColumnName SYSNAME set @ColumnName = N'message'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Log Message';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'scheduled_task_log'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.scheduled_task_log'; DECLARE @ColumnName SYSNAME set @ColumnName = N'start_time'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Task Start Time';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'scheduled_task_log'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.scheduled_task_log'; DECLARE @ColumnName SYSNAME set @ColumnName = N'end_time'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Task End Time';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230307-sc-1', 'shu.cui', 'nschema/2307.changeLog.xml', GETDATE(), 843, '8:e9cd9692154dde41f8f53f518fc560a8', 'createTable tableName=scheduled_task_log', 'PL-5077 Create table to store scheduled task history', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230317-ct-1::craig.taylor
-- PL-5103 for PL-4923 User MFA
CREATE TABLE user_mfa (userid nvarchar(85) NOT NULL, mfaBypass char(1) CONSTRAINT DF_user_mfa_mfaBypass DEFAULT 'N' NOT NULL, onetimepass nvarchar(255), onetimeexpiration datetime)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.user_mfa';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User MFA configuration';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_mfa'; DECLARE @ColumnName SYSNAME set @ColumnName = N'userid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'reference user id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_mfa'; DECLARE @ColumnName SYSNAME set @ColumnName = N'mfaBypass'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'mfaBypass enum Y-bypass_enabled, N-bypass_disabled';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_mfa'; DECLARE @ColumnName SYSNAME set @ColumnName = N'onetimepass'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'one time password';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_mfa'; DECLARE @ColumnName SYSNAME set @ColumnName = N'onetimeexpiration'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'expiration date for one time password';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230317-ct-1', 'craig.taylor', 'nschema/2307.changeLog.xml', GETDATE(), 844, '8:f7729beb69a553a0b4aa7353945999dd', 'createTable tableName=user_mfa', 'PL-5103 for PL-4923 User MFA', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230413-rb-1::Ryan.Buchanan
ALTER TABLE user_mfa ADD lastSuccessfulLogin datetime
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_mfa'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_mfa'; DECLARE @ColumnName SYSNAME set @ColumnName = N'lastSuccessfulLogin'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'date of last successful login attempt';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230413-rb-1', 'Ryan.Buchanan', 'nschema/2307.changeLog.xml', GETDATE(), 845, '8:7be5c74a1105d4b2d24a46c59a503ac4', 'addColumn tableName=user_mfa', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230419-sc-1::shu.cui
-- PL-5159 change organization code length
ALTER TABLE code_orgstructure ALTER COLUMN orgcode nvarchar(255)
GO

ALTER TABLE code_orgstructure ALTER COLUMN description nvarchar(255)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230419-sc-1', 'shu.cui', 'nschema/2307.changeLog.xml', GETDATE(), 846, '8:d4f40a9a9f3a081875c15ddd5c4eeca8', 'modifyDataType columnName=orgcode, tableName=code_orgstructure; modifyDataType columnName=description, tableName=code_orgstructure', 'PL-5159 change organization code length', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230427-rl-1::richard.li
-- PLC-135 Create Encrypt, Report Location and SFTP Transfer in the Schedule Report Properties screen
ALTER TABLE schedule_report ADD encrypt char(1) CONSTRAINT DF_schedule_report_encrypt DEFAULT 'N' NOT NULL
GO

ALTER TABLE schedule_report ADD report_location nvarchar(255)
GO

ALTER TABLE schedule_report ADD sftp_transfer_id nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'schedule_report'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.schedule_report'; DECLARE @ColumnName SYSNAME set @ColumnName = N'encrypt'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Whether need encrypt the report';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'schedule_report'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.schedule_report'; DECLARE @ColumnName SYSNAME set @ColumnName = N'report_location'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Report location';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'schedule_report'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.schedule_report'; DECLARE @ColumnName SYSNAME set @ColumnName = N'sftp_transfer_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The ID of the SFTP Transfer';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230427-rl-1', 'richard.li', 'nschema/2307.changeLog.xml', GETDATE(), 847, '8:ada9338d7b439689de2edda304de23da', 'addColumn tableName=schedule_report', 'PLC-135 Create Encrypt, Report Location and SFTP Transfer in the Schedule Report Properties screen', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230503-mg-1::michael.gorohov
ALTER TABLE transcript ADD percent_completion int
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'transcript'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.transcript'; DECLARE @ColumnName SYSNAME set @ColumnName = N'percent_completion'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Percentage of Completion';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230503-mg-1', 'michael.gorohov', 'nschema/2307.changeLog.xml', GETDATE(), 848, '8:041565ab7ae1b18538e0cce874aa8794', 'addColumn tableName=transcript', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230503-mg-3::michael.gorohov
DROP VIEW aggregated_transcript_vw
GO

CREATE VIEW aggregated_transcript_vw AS SELECT
            t1.transcriptid,
            a2.userid,
            t1.learningid,
            t1.currid,
            t1.learningType,
            t1.eventid,
            t1.startdate,
            t1.finishdate,
            t1.finalgrade,
            t1.studentstatus,
            tsub.substatus_code,
            tsub.substatus_name,
            t1.progress,
            t1.assessDate,
            t1.attendance,
            t1.perfGradeid,
            t1.sessionid,
            t1.creditTranscriptLink,
            t1.curriculumTranscriptLink,
            t1.assessmentscore,
            t1.requestSource,
            t1.contentSessionID,
            t1.certSessionID,
            t1.enrollmentDate,
            t1.remindercount,
            t1.costcenter,
            t1.confirmation_status,
            t1.reopen,
            t1.isOpen,
            t1.pre_assess_score,
            t1.post_assess_score,
            t1.settings_as_of_date,
            t1.quick_eval,
            t1.notifyemail,
            t1.completion_deadline,
            t1.deadline_expired,
            t1.revision_number,
            t1.ntraininghours,
            t1.allowDappraiserAssess,
            t1.offline_key,
            t1.mekp_sync,
            t1.send_notif_ew,
            t1.update_meaning,
            t1.last_updated,
            t1.updater_legal_name,
            t1.update_meaning_text,
            t1.last_updater_uid,
            t1.creator_uid,
            t1.datecreated,
            t1.curr_total_time,
            t1.attempts_allowed,
            t1.grading_method,
            t1.attempts_count,
            t1.completion_method,
            t1.final_score,
            t1.weighting,
            t1.weightedscore,
            t1.percent_completion,
            case when EXISTS(SELECT * FROM submod_tran_subt WHERE program_tran_id = t1.transcriptid) then 'Y'
            else 'N' end as sub_learning,
            case when a2.userid = t1.userid then 'Y' else 'N' end belongsToLearnerAssignment,
            t1.is_reqd_custom_attr_complete,
            t1.bundle_id,
            t1.allowBundleSwitch,
            case when lang.ilangid is null then lang.locale else cast(lang.ilangid as char) end language_tag,
            t1.transcriptid as resolved_transcriptid
            FROM transcript t1
            inner join users_assignment a1 on a1.userid = t1.userid
            inner join users_assignment a2 on a2.user_meta_id = a1.user_meta_id
            left join transcript_substatus tsub on t1.student_substatus = tsub.id
            inner join language_bundle lang on lang.bundle_id = t1.bundle_id
            WHERE t1.studentstatus NOT IN (8, 9, 10)
            UNION ALL
            SELECT
            a.transcriptid,
            a2.userid,
            a.learningid,
            a.currid,
            a.learningType,
            a.eventid,
            b.startdate,
            b.finishdate,
            b.finalgrade,
            b.studentstatus,
            tsub.substatus_code,
            tsub.substatus_name,
            b.progress,
            b.assessDate,
            b.attendance,
            b.perfGradeid,
            a.sessionid,
            CASE WHEN 1=1 THEN NULL ELSE '' END as creditTranscriptLink,
            a.curriculumTranscriptLink,
            b.assessmentscore,
            a.requestSource,
            b.contentSessionID,
            b.certSessionID,
            a.enrollmentDate,
            b.remindercount,
            b.costcenter,
            b.confirmation_status,
            b.reopen,
            a.isOpen,
            b.pre_assess_score,
            b.post_assess_score,
            b.settings_as_of_date,
            b.quick_eval,
            b.notifyemail,
            b.completion_deadline,
            b.deadline_expired,
            b.revision_number,
            b.ntraininghours,
            b.allowDappraiserAssess,
            b.offline_key,
            b.mekp_sync,
            b.send_notif_ew,
            b.update_meaning,
            b.last_updated,
            b.updater_legal_name,
            a.update_meaning_text,
            a.last_updater_uid,
            a.creator_uid,
            a.datecreated,
            b.curr_total_time,
            b.attempts_allowed,
            b.grading_method,
            b.attempts_count,
            b.completion_method,
            b.final_score,
            b.weighting,
            b.weightedscore,
            b.percent_completion,
            case when EXISTS(SELECT * FROM submod_tran_subt WHERE program_tran_id = b.transcriptid) then 'Y'
            else 'N' end as sub_learning,
            case when a2.userid = a.userid then 'Y' else 'N' end belongsToLearnerAssignment,
            b.is_reqd_custom_attr_complete,
            b.bundle_id,
            b.allowBundleSwitch,
            case when lang.ilangid is null then lang.locale else cast(lang.ilangid as char) end language_tag,
            a.creditTranscriptLink as resolved_transcriptid
            FROM transcript a
            inner join transcript b on b.transcriptid = a.creditTranscriptLink
            inner join users_assignment a1 on a1.userid = a.userid
            inner join users_assignment a2 on a2.user_meta_id = a1.user_meta_id
            left join transcript_substatus tsub on a.student_substatus = tsub.id
            inner join language_bundle lang on b.bundle_id = lang.bundle_id
            WHERE a.studentstatus = 8 AND b.transcriptid = a.creditTranscriptLink AND b.studentstatus NOT IN (8, 9, 10)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230503-mg-3', 'michael.gorohov', 'nschema/2307.changeLog.xml', GETDATE(), 849, '8:68b1a12e4695530fa8e21d74b861d117', 'dropView viewName=aggregated_transcript_vw; createView viewName=aggregated_transcript_vw', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230505-jw-1::Justin.wang
-- SFTP Location  in DB
CREATE TABLE sftp_location (id nvarchar(15) NOT NULL, display_name nvarchar(255) NOT NULL, created_by nvarchar(85), created_date datetime, last_update_by nvarchar(85), last_updated datetime, url nvarchar(255) NOT NULL, port numeric(5, 0) NOT NULL, loginName nvarchar(255) NOT NULL, password nvarchar(255), sshKey nvarchar(4000), isByPassword char(1) CONSTRAINT DF_sftp_location_isByPassword DEFAULT 'Y' NOT NULL, CONSTRAINT PK_SFTP_LOCATION PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location display name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'created By';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'created date';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_update_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'last update by';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'last updated';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location url';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'port'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location port';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'loginName'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location loginName';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'password'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location password';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sftp_location'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sftp_location'; DECLARE @ColumnName SYSNAME set @ColumnName = N'sshKey'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'SFTP Location sshKey';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230505-jw-1', 'Justin.wang', 'nschema/2307.changeLog.xml', GETDATE(), 850, '8:ff176493b433a227e99867214f0a0828', 'createTable tableName=sftp_location', 'SFTP Location  in DB', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230525-ct-1::craig.taylor
-- Additional options for exams
ALTER TABLE mastertest ADD rcd_post_compl_attempt char(1) CONSTRAINT DF_mastertest_rcd_post_compl_attempt DEFAULT 'N' NOT NULL
GO

ALTER TABLE mastertest ADD rcd_post_compl_max_score char(1) CONSTRAINT DF_mastertest_rcd_post_compl_max_score DEFAULT 'N' NOT NULL
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230525-ct-1', 'craig.taylor', 'nschema/2307.changeLog.xml', GETDATE(), 851, '8:dfbb9c7cf8bf067d5d635c641443b43b', 'addColumn tableName=mastertest', 'Additional options for exams', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2307.changeLog.xml::20230525-ct-2::craig.taylor
-- Keep MFA number of attempts
ALTER TABLE user_mfa ADD nAttempts int CONSTRAINT DF_user_mfa_nAttempts DEFAULT 0 NOT NULL
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230525-ct-2', 'craig.taylor', 'nschema/2307.changeLog.xml', GETDATE(), 852, '8:ceab46d17dd10d83391c5c273a552b1f', 'addColumn tableName=user_mfa', 'Keep MFA number of attempts', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230613-em-1::emmar.masagca
UPDATE ekpversion SET dblevel = 2311, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230613-em-1', 'emmar.masagca', 'nschema/2311.changeLog.xml', GETDATE(), 853, '8:816cf5563e42001d3ca135768035adf2', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230630-mg-1::michael.gorohov
-- PL-5920 Database changes for post-exam information field and description column type update
ALTER TABLE mastertest ADD post_exam_info nvarchar (max)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'post_exam_info'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Post-Exam Information';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230630-mg-1', 'michael.gorohov', 'nschema/2311.changeLog.xml', GETDATE(), 854, '8:8225d53f9dee11d1f2682068b6018705', 'addColumn tableName=mastertest', 'PL-5920 Database changes for post-exam information field and description column type update', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230711-jw-1::Justin.wang
-- Configuration for skipping questions at exam Level
ALTER TABLE mastertest ADD missing_answer char(1) CONSTRAINT DF_mastertest_missing_answer DEFAULT 'G' NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'missing_answer'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'G means to use the global system default setting,               F means force answer,all questions must be answered,               W means warning only,allow user to skip question(s)';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230711-jw-1', 'Justin.wang', 'nschema/2311.changeLog.xml', GETDATE(), 855, '8:79923ee525eb81597566fb941abc72c7', 'addColumn tableName=mastertest', 'Configuration for skipping questions at exam Level', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230711-jw-2::Justin.wang
-- Allow unlimited printing of the exam
ALTER TABLE mastertest ADD allow_unlimited_print char(1) CONSTRAINT DF_mastertest_allow_unlimited_print DEFAULT 'N' NOT NULL
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230711-jw-2', 'Justin.wang', 'nschema/2311.changeLog.xml', GETDATE(), 856, '8:08a25df9f3fc2af392d00cef8f7ab56a', 'addColumn tableName=mastertest', 'Allow unlimited printing of the exam', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230830-rb-1::ryan.buchanan
-- PL-6166 Database changes for Resit Calculation
ALTER TABLE mastertest ADD resitForOverallExam char(1) CONSTRAINT DF_mastertest_resitForOverallExam DEFAULT 'N' NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'resitForOverallExam'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Resit Calculation For Overall Exam';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230830-rb-1', 'ryan.buchanan', 'nschema/2311.changeLog.xml', GETDATE(), 857, '8:0d7c66d19464f3cb6285bca145d22655', 'addColumn tableName=mastertest', 'PL-6166 Database changes for Resit Calculation', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20230910-jw-1::Justin.wang
-- Allow Multiple Choice Partial Credit of the exam
ALTER TABLE mastertest ADD partial_credit char(1) CONSTRAINT DF_mastertest_partial_credit DEFAULT 'G' NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'mastertest'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.mastertest'; DECLARE @ColumnName SYSNAME set @ColumnName = N'partial_credit'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'G means to use the global system default setting,               A All or Nothing,               U Uniform Partial Credit';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20230910-jw-1', 'Justin.wang', 'nschema/2311.changeLog.xml', GETDATE(), 858, '8:0320ffdd748e9c0f7f95b93c628b8a28', 'addColumn tableName=mastertest', 'Allow Multiple Choice Partial Credit of the exam', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2311.changeLog.xml::20231003-mg-1::michael.gorohov
CREATE TABLE template_widget_recom_config (widget_id nvarchar(15) NOT NULL, title nvarchar(255), recommendation_setting nvarchar(15), CONSTRAINT PK_WIDGET_RECOM_CONFIG PRIMARY KEY (widget_id))
GO

ALTER TABLE template_widget_recom_config ADD CONSTRAINT FK_WIDGET_RECOM_CONFIG FOREIGN KEY (widget_id) REFERENCES template_widget (id) ON DELETE CASCADE
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231003-mg-1', 'michael.gorohov', 'nschema/2311.changeLog.xml', GETDATE(), 859, '8:61902214514ad1205728435530df8c22', 'createTable tableName=template_widget_recom_config; addForeignKeyConstraint baseTableName=template_widget_recom_config, constraintName=FK_WIDGET_RECOM_CONFIG, referencedTableName=template_widget', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2401.changeLog.xml::20231110-rn-1::ronald.ng
UPDATE ekpversion SET dblevel = 2401, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231110-rn-1', 'ronald.ng', 'nschema/2401.changeLog.xml', GETDATE(), 860, '8:f72102ac306cea3777ca728e64e4a6de', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2401.changeLog.xml::20231113-rli-1::richard.li
-- PLC-301-Changes to User Editor
ALTER TABLE userprefs_assignment ADD job_profile_group_type smallint CONSTRAINT DF_userprefs_assignment_job_profile_group_type DEFAULT 255 NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'userprefs_assignment'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.userprefs_assignment'; DECLARE @ColumnName SYSNAME set @ColumnName = N'job_profile_group_type'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Job Profile Group assignment type: 255-All; 254-Specific';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231113-rli-1', 'richard.li', 'nschema/2401.changeLog.xml', GETDATE(), 861, '8:87c00b68a43fc05abcfe49e9324c6119', 'addColumn tableName=userprefs_assignment', 'PLC-301-Changes to User Editor', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2401.changeLog.xml::20231113-rli-2::richard.li
-- PLC-301-Changes to User Editor
CREATE TABLE user_job_profile_groups_map (userid nvarchar(85) NOT NULL, job_profile_group_id nvarchar(15) NOT NULL)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_job_profile_groups_map'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_job_profile_groups_map'; DECLARE @ColumnName SYSNAME set @ColumnName = N'userid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_job_profile_groups_map'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_job_profile_groups_map'; DECLARE @ColumnName SYSNAME set @ColumnName = N'job_profile_group_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Job Profile Group ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE user_job_profile_groups_map ADD CONSTRAINT PK_USER_JOB_PROFILE_GROUPS_MAP PRIMARY KEY (userid, job_profile_group_id)
GO

ALTER TABLE user_job_profile_groups_map ADD CONSTRAINT FK_USER_JOB_PROFILE_GROUPS_MAP FOREIGN KEY (job_profile_group_id) REFERENCES job_profile_group (id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231113-rli-2', 'richard.li', 'nschema/2401.changeLog.xml', GETDATE(), 862, '8:00e69726e5d3ab5196a9c3a9b291c886', 'createTable tableName=user_job_profile_groups_map; addPrimaryKey constraintName=PK_USER_JOB_PROFILE_GROUPS_MAP, tableName=user_job_profile_groups_map; addForeignKeyConstraint baseTableName=user_job_profile_groups_map, constraintName=FK_USER_JOB_PR...', 'PLC-301-Changes to User Editor', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2401.changeLog.xml::20231113-rli-3::richard.li
-- PLC-301-Changes to User Editor
DROP VIEW userprefs
GO

CREATE VIEW userprefs AS select userprefs_assignment.userid,
            userprefs_assignment.contentServer,
            userprefs_assignment.ui,
            users_meta.languagepref,
            userprefs_assignment.autoMailList,
            userprefs_assignment.autoRegMsg,
            users_meta.useExternalMail,
            userprefs_assignment.initialURL,
            userprefs_assignment.resultsPerPage,
            userprefs_assignment.catalogid,
            userprefs_assignment.userPref1,
            userprefs_assignment.userPref2,
            userprefs_assignment.time_zone,
            users_meta.email_forward_type,
            users_meta.forward_to_email,
            userprefs_assignment.welcome_email_senddate,
            users_meta.block_notification,
            userprefs_assignment.enable_newui,
            userprefs_assignment.job_profile_group_type
            from userprefs_assignment
            JOIN users_assignment on userprefs_assignment.userid = users_assignment.userid
            JOIN users_meta on users_assignment.user_meta_id = users_meta.user_meta_id
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231113-rli-3', 'richard.li', 'nschema/2401.changeLog.xml', GETDATE(), 863, '8:953e47cc314862442d7c25b35d29ad2b', 'dropView viewName=userprefs; createView viewName=userprefs', 'PLC-301-Changes to User Editor', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2404.changeLog.xml::20231017-rn-1::ronald.ng
UPDATE ekpversion SET dblevel = 2404, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231017-rn-1', 'ronald.ng', 'nschema/2404.changeLog.xml', GETDATE(), 864, '8:0864154247c316babb25d4fc92879d5c', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2404.changeLog.xml::20231120-sc-1::shu.cui
-- NSD-9066 Update session enrollment count calculation logic
DROP VIEW cschedule_nreserved_vw
GO

CREATE VIEW cschedule_nreserved_vw AS SELECT c.courseid, c.eventid,
                   SUM(CASE WHEN t.studentstatus IS NULL THEN 0
                            WHEN m.consider_reserve_only='N' THEN 1
                            WHEN (m.consider_reserve_only='Y' AND t.reserve_seat ='Y' AND t.studentstatus = 7) THEN 1
                            WHEN (m.consider_reserve_only='Y' AND t.reserve_seat ='Y' AND t.studentstatus = 1 AND c.availability!='X') THEN 1
                            ELSE 0 END) nreserved
            FROM cschedule c
                     INNER JOIN code_enroll_cnt_method m ON m.method = c.enroll_cnt_method
                     LEFT JOIN transcript t ON t.eventid = c.eventid AND t.studentstatus = m.studentstatus
            GROUP BY c.courseid, c.eventid
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20231120-sc-1', 'shu.cui', 'nschema/2404.changeLog.xml', GETDATE(), 865, '8:2b0f4a58d50013ed473fc58875a24842', 'dropView viewName=cschedule_nreserved_vw; createView viewName=cschedule_nreserved_vw', 'NSD-9066 Update session enrollment count calculation logic', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2404.changeLog.xml::20240311-yf-1::yueqin.feng
-- PL-7239: Change the current PeopleFluent LMS Default skin to use the new colors and logo
UPDATE screenLayout SET primary_color = '#1F3055', secondary_color = '#2A4072' WHERE shortname='PeopleFluent_LMS_Default' AND directory='lms-skin'
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240311-yf-1', 'yueqin.feng', 'nschema/2404.changeLog.xml', GETDATE(), 866, '8:469b44cba4ee3371ad0566b432590317', 'update tableName=screenLayout', 'PL-7239: Change the current PeopleFluent LMS Default skin to use the new colors and logo', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2404.changeLog.xml::20240228-jw-1::Justin.wang
-- PLC-340 Configuring the Courses
CREATE TABLE lti_tool_launcher (course_id nvarchar(85) NOT NULL, lti_tool_id nvarchar(85) NOT NULL, last_updater_uid nvarchar(85), last_updated datetime, updater_legal_name nvarchar(1000), update_meaning_text nvarchar (max), CONSTRAINT PK_LTI_TOOL_COURSE PRIMARY KEY (course_id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Primary key, Learning ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'lti_tool_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'LTI Tool ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updater_uid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'UID of change maker';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'System datetime of the change';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'updater_legal_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Legal name of change maker';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool_launcher'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool_launcher'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning_text'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update remark';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240228-jw-1', 'Justin.wang', 'nschema/2404.changeLog.xml', GETDATE(), 867, '8:f222d29a8ccdff92091c1d17ce46c1c3', 'createTable tableName=lti_tool_launcher', 'PLC-340 Configuring the Courses', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2404.changeLog.xml::20240228-jw-2::Justin.wang
-- PLC-338 TLI Tool in DB
CREATE TABLE lti_tool (id nvarchar(85) NOT NULL, lti_version nvarchar(255) NOT NULL, lti_code nvarchar(255) NOT NULL, lti_display_name nvarchar(255) NOT NULL, public_key nvarchar(4000) NOT NULL, init_url nvarchar(1024) NOT NULL, redirect_url nvarchar(1024) NOT NULL, is_send_anon char(1) CONSTRAINT DF_lti_tool_is_send_anon DEFAULT 'Y' NOT NULL, is_multiple_enroll char(1) CONSTRAINT DF_lti_tool_is_multiple_enroll DEFAULT 'Y' NOT NULL, issuer nvarchar(255), client_id nvarchar(255), deployment_id nvarchar(255), odic_url nvarchar(255), jwks_endpoint nvarchar(255), max_inactive_interval nvarchar(255), CONSTRAINT PK_LTI_Tool PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'LTI Tool ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'lti_version'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'LTI Tool version';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'lti_code'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'LTI Tool code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'lti_display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'LTI Tool display name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'public_key'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The RSA 256 public key associated with the tool.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'init_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The endpoint the platform will use to initiate the OpenID Connect authorization flow';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'redirect_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'One or more URIs where the OIDC Authorization Response can be sent';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'issuer'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The value of the required LtiPlatformIssuer configuration setting';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'client_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The OAuth Client Id for the tool. JSON Web Tokens sent to the tool will have this value in the aud claim.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'deployment_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'An identifier for the integration between the platform and the tool. Identical to the connectorId.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'odic_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The endpoint where the tool should send the OIDC Authorization Request.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'jwks_endpoint'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'A link to access the platform''s JSON Web Key Set. This will be an absolute, unsecured URL to the /plugin/lti13/{connectorId}/jwks endpoint.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240228-jw-2', 'Justin.wang', 'nschema/2404.changeLog.xml', GETDATE(), 868, '8:e7b0054a8b56ad130626da102e529071', 'createTable tableName=lti_tool', 'PLC-338 TLI Tool in DB', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240415-sc-1::shu.cui
UPDATE ekpversion SET dblevel = 2409, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240415-sc-1', 'shu.cui', 'nschema/2409.changeLog.xml', GETDATE(), 869, '8:8c4aa1a83e7a6a74659dfba949d6814d', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240229-rli-1::richard.li
-- PLC-347: Add Job Profile Assignment type attribute in Job Profile Group Assign screen
CREATE TABLE assignment_type_attribute (user_id nvarchar(85) NOT NULL, job_profile_id nvarchar(15) NOT NULL, attribute_id nvarchar(15) NOT NULL, attribute_value_data nvarchar(2000), update_meaning nvarchar(8), last_updated datetime, updater_legal_name nvarchar(250), update_meaning_text nvarchar (max), last_updater_uid nvarchar(85))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores details of job profile assignment type attributes';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'job_profile_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Job Profile';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of job profile assignment type attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_value_data'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Value of job profile assignment type attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'updater_legal_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: legal name of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning_text'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: update meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'assignment_type_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.assignment_type_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updater_uid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: ID of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE assignment_type_attribute ADD CONSTRAINT PK_ASSIGNMENT_TYPE_ATTRIBUTE PRIMARY KEY (user_id, job_profile_id, attribute_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240229-rli-1', 'richard.li', 'nschema/2409.changeLog.xml', GETDATE(), 870, '8:b706575d18b983c9bb9c8958f82fdf5f', 'createTable tableName=assignment_type_attribute; addPrimaryKey constraintName=PK_ASSIGNMENT_TYPE_ATTRIBUTE, tableName=assignment_type_attribute', 'PLC-347: Add Job Profile Assignment type attribute in Job Profile Group Assign screen', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240329-rli-1::richard.li
-- PLC-367: Add Job Profile attribute in Job Profile Editor
CREATE TABLE job_profile_attribute (job_profile_id nvarchar(15) NOT NULL, attribute_id nvarchar(15) NOT NULL, attribute_value_data nvarchar(2000), update_meaning nvarchar(8), last_updated datetime, updater_legal_name nvarchar(250), update_meaning_text nvarchar (max), last_updater_uid nvarchar(85))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.job_profile_attribute';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores details of job profile attributes';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'job_profile_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Job Profile';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of job profile attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_value_data'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Value of job profile attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'updater_legal_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: legal name of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning_text'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: update meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'job_profile_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.job_profile_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updater_uid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: ID of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE job_profile_attribute ADD CONSTRAINT PK_JOB_PROFILE_ATTRIBUTE PRIMARY KEY (job_profile_id, attribute_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240329-rli-1', 'richard.li', 'nschema/2409.changeLog.xml', GETDATE(), 871, '8:b01e4bb52588612204e54ed03b29a8fb', 'createTable tableName=job_profile_attribute; addPrimaryKey constraintName=PK_JOB_PROFILE_ATTRIBUTE, tableName=job_profile_attribute', 'PLC-367: Add Job Profile attribute in Job Profile Editor', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240607-rli-1::richard.li
-- PLC-375: Add competency attribute in Competency Editor
CREATE TABLE competency_attribute (competency_id nvarchar(15) NOT NULL, attribute_id nvarchar(15) NOT NULL, attribute_value_data nvarchar(2000), update_meaning nvarchar(8), last_updated datetime, updater_legal_name nvarchar(250), update_meaning_text nvarchar (max), last_updater_uid nvarchar(85))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.competency_attribute';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores details of competency attributes';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'competency_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Competency';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of competency attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'attribute_value_data'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Value of competency attribute';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Update Datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'updater_legal_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: legal name of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_meaning_text'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: update meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'competency_attribute'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.competency_attribute'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_updater_uid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'e-Signature property: ID of updater';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE competency_attribute ADD CONSTRAINT PK_COMPETENCY_ATTRIBUTE PRIMARY KEY (competency_id, attribute_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240607-rli-1', 'richard.li', 'nschema/2409.changeLog.xml', GETDATE(), 872, '8:c045591e7e3a4e4cb1a7e3d4f4033a20', 'createTable tableName=competency_attribute; addPrimaryKey constraintName=PK_COMPETENCY_ATTRIBUTE, tableName=competency_attribute', 'PLC-375: Add competency attribute in Competency Editor', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240626-em-1::emmar.masagca
-- PL-3620 - VILT - MS Teams - Add a function to allow syncing of attendees
ALTER TABLE vc_ms_teams_session ADD update_history_status char(1)
GO

ALTER TABLE vc_ms_teams_session ADD last_update_history_time datetime
GO

ALTER TABLE vc_ms_teams_session ADD last_update_history_uid nvarchar(85)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_ms_teams_session'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_ms_teams_session'; DECLARE @ColumnName SYSNAME set @ColumnName = N'update_history_status'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Status of the update history';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_ms_teams_session'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_ms_teams_session'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_update_history_time'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Last update history time';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_ms_teams_session'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_ms_teams_session'; DECLARE @ColumnName SYSNAME set @ColumnName = N'last_update_history_uid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Last update history user ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240626-em-1', 'emmar.masagca', 'nschema/2409.changeLog.xml', GETDATE(), 873, '8:02e120def0118559f0e603bc0722e0c4', 'addColumn tableName=vc_ms_teams_session', 'PL-3620 - VILT - MS Teams - Add a function to allow syncing of attendees', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240704-yf-1::yueqin.feng
-- NSD-9490: Add Forgot password email url setting in Organization and Logical Domain
ALTER TABLE code_orgstructure ADD forget_password_email_link_url nvarchar(255)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'code_orgstructure'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.code_orgstructure'; DECLARE @ColumnName SYSNAME set @ColumnName = N'forget_password_email_link_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The URL used for forget password email link at organization level';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE logical_domain ADD forget_password_email_link_url nvarchar(255)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'logical_domain'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.logical_domain'; DECLARE @ColumnName SYSNAME set @ColumnName = N'forget_password_email_link_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The URL used for forget password email link';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240704-yf-1', 'yueqin.feng', 'nschema/2409.changeLog.xml', GETDATE(), 874, '8:6381cdfa78fc8d820869073dd56c80fd', 'addColumn tableName=code_orgstructure; addColumn tableName=logical_domain', 'NSD-9490: Add Forgot password email url setting in Organization and Logical Domain', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240611-md-1::mark.dacles
-- NSD-9514 [TCC] Session Title limit on CSV formatting help vs database
ALTER TABLE sessiondetail ALTER COLUMN session_title nvarchar(255)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240611-md-1', 'mark.dacles', 'nschema/2409.changeLog.xml', GETDATE(), 875, '8:14fb73b31e1808dae5bf98c64482dd05', 'modifyDataType columnName=session_title, tableName=sessiondetail', 'NSD-9514 [TCC] Session Title limit on CSV formatting help vs database', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240714-rn-1::ronald.ng
-- PL-7741: Add navigation style field for frameless skin
ALTER TABLE screenLayout ADD navigation_style nvarchar(85) CONSTRAINT DF_screenLayout_navigation_style DEFAULT 'top' NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'screenLayout'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.screenLayout'; DECLARE @ColumnName SYSNAME set @ColumnName = N'navigation_style'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'define navigation style for frameless skin, e.g. left';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

UPDATE screenLayout SET navigation_style = 'left' WHERE shortname LIKE '%PeopleFluent_%Default%' AND directory='lms-skin'
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240714-rn-1', 'ronald.ng', 'nschema/2409.changeLog.xml', GETDATE(), 876, '8:dcbddeac848d0986bd30d319eb1524d5', 'addColumn tableName=screenLayout; update tableName=screenLayout', 'PL-7741: Add navigation style field for frameless skin', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240722-rn-2::ronald.ng
-- PL-7839: New Function: Bookmarked Features
CREATE TABLE bookmarks (assignment_id nvarchar(85) NOT NULL, tx_code nvarchar(255) NOT NULL, parameters nvarchar(85) NOT NULL, creation_date datetime NOT NULL)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'bookmarks'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.bookmarks';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores bookmarks saved by users';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'bookmarks'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.bookmarks'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assignment_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assignment ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'bookmarks'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.bookmarks'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tx_code'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'TX Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'bookmarks'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.bookmarks'; DECLARE @ColumnName SYSNAME set @ColumnName = N'parameters'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'TX Parameters';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'bookmarks'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.bookmarks'; DECLARE @ColumnName SYSNAME set @ColumnName = N'creation_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Bookmark Creation Date';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE bookmarks ADD CONSTRAINT PK_BOOKMARKS PRIMARY KEY (assignment_id, tx_code, parameters)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240722-rn-2', 'ronald.ng', 'nschema/2409.changeLog.xml', GETDATE(), 877, '8:cd45635c0d57bca481a1cb6cc54da19d', 'createTable tableName=bookmarks; addPrimaryKey constraintName=PK_BOOKMARKS, tableName=bookmarks', 'PL-7839: New Function: Bookmarked Features', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240814-jw-1::justin.wang
-- PLC-337 LTI Tool Course Integration - add new field
ALTER TABLE lti_tool ADD connector_id nvarchar(255)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'lti_tool'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.lti_tool'; DECLARE @ColumnName SYSNAME set @ColumnName = N'connector_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Unique identifier of the Content Connector';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240814-jw-1', 'justin.wang', 'nschema/2409.changeLog.xml', GETDATE(), 878, '8:a98e0d5c78ea0f17b78cb7655d9c4e68', 'addColumn tableName=lti_tool', 'PLC-337 LTI Tool Course Integration - add new field', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240814-jw-2::justin.wang
-- PLC-337 LTI Tool Course Integration- change db schema
exec sp_rename 'lti_tool.max_inactive_interval', 'access_token_url'
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240814-jw-2', 'justin.wang', 'nschema/2409.changeLog.xml', GETDATE(), 879, '8:03153b1d600ef805b8cb08d9453bb669', 'renameColumn newColumnName=access_token_url, oldColumnName=max_inactive_interval, tableName=lti_tool', 'PLC-337 LTI Tool Course Integration- change db schema', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2409.changeLog.xml::20240829-rn-1::ronald.ng
-- PL-7868: Backend Prep for New Skin Release
UPDATE screenLayout SET legacymode = 'N', mouseovermenu = 'N' WHERE shortname LIKE '%PeopleFluent_%Default%' AND directory='lms-skin'
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240829-rn-1', 'ronald.ng', 'nschema/2409.changeLog.xml', GETDATE(), 880, '8:b86eff0eaf9c7b872fa327ccec1add27', 'update tableName=screenLayout', 'PL-7868: Backend Prep for New Skin Release', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20240913-md-1::mark.dacles
UPDATE ekpversion SET dblevel = 2502, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240913-md-1', 'mark.dacles', 'nschema/2502.changeLog.xml', GETDATE(), 881, '8:e228d8a2fd74d034180605e906172782', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20240925-jw-1::Justin.wang
-- PLC-505: Increase the length of the database field launchParms to 2048
ALTER TABLE course ALTER COLUMN launchParms nvarchar(2048)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240925-jw-1', 'Justin.wang', 'nschema/2502.changeLog.xml', GETDATE(), 882, '8:a413a9be2e9a690ee2e90cd4d925e941', 'modifyDataType columnName=launchParms, tableName=course', 'PLC-505: Increase the length of the database field launchParms to 2048', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241015-em-1::emmar.masagca
-- PL-8230 - Added allow_session_transfer column for Programs
ALTER TABLE curriculum ADD allow_session_transfer nvarchar(1) CONSTRAINT DF_curriculum_allow_session_transfer DEFAULT 'N'
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'curriculum'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.curriculum'; DECLARE @ColumnName SYSNAME set @ColumnName = N'allow_session_transfer'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Flag to indicate session transfer for participants and reviewers is allowed';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241015-em-1', 'emmar.masagca', 'nschema/2502.changeLog.xml', GETDATE(), 883, '8:af9c423a677f56a6dae6985f561ae52b', 'addColumn tableName=curriculum', 'PL-8230 - Added allow_session_transfer column for Programs', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241004-yf-1::yueqin.feng
-- PL-8229: Cohort-support Enhancements
ALTER TABLE sessiondetail ADD allow_self_enroll_to_prompt nvarchar(1) CONSTRAINT DF_sessiondetail_allow_self_enroll_to_prompt DEFAULT 'N' NOT NULL
GO

ALTER TABLE sessiondetail ADD show_session_sel_rmdr nvarchar(1) CONSTRAINT DF_sessiondetail_show_session_sel_rmdr DEFAULT 'N' NOT NULL
GO

ALTER TABLE sessiondetail ADD seatlimit int CONSTRAINT DF_sessiondetail_seatlimit DEFAULT 0 NOT NULL
GO

ALTER TABLE sessiondetail ADD min_size int CONSTRAINT DF_sessiondetail_min_size DEFAULT 0 NOT NULL
GO

ALTER TABLE sessiondetail ADD enroll_cnt_method nvarchar(1) CONSTRAINT DF_sessiondetail_enroll_cnt_method DEFAULT 'A'
GO

ALTER TABLE sessiondetail ADD withdrawn_nday int CONSTRAINT DF_sessiondetail_withdrawn_nday DEFAULT 0
GO

ALTER TABLE sessiondetail ADD transfer_dropped_to_session nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'allow_self_enroll_to_prompt'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Flag to indicate self-enrollment to prompt session is allowed';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'show_session_sel_rmdr'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Flag to control session selection reminder in login notification';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'seatlimit'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Enrollment limit';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'min_size'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Minimum size Enrollment Limit';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'enroll_cnt_method'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Flag to indicate whether to count pending approval records in total current enrollments';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'withdrawn_nday'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Cannot withdraw within days of the start date';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'transfer_dropped_to_session'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Event ID of the target session to transfer to upon dropping from waitlist';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

CREATE VIEW sessiondetail_nreserved_vw AS SELECT s.currid, s.sessionid,
                   SUM(CASE WHEN t.studentstatus IS NULL THEN 0
                            WHEN m.consider_reserve_only='N' THEN 1
                            WHEN (m.consider_reserve_only='Y' AND t.reserve_seat ='Y' AND t.studentstatus = 7) THEN 1
                            WHEN (m.consider_reserve_only='Y' AND t.reserve_seat ='Y' AND t.studentstatus = 1 AND s.availability!='X') THEN 1
                            ELSE 0 END) nreserved
            FROM sessiondetail s
                     INNER JOIN code_enroll_cnt_method m ON m.method = s.enroll_cnt_method
                     LEFT JOIN transcript t ON t.learningid = s.currid AND t.eventid = s.sessionid AND t.studentstatus = m.studentstatus
            GROUP BY s.currid, s.sessionid
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241004-yf-1', 'yueqin.feng', 'nschema/2502.changeLog.xml', GETDATE(), 884, '8:b05608118fe707800e45f39210b15475', 'addColumn tableName=sessiondetail; createView viewName=sessiondetail_nreserved_vw', 'PL-8229: Cohort-support Enhancements', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241107-jw-1::Justin.wang
-- PLC-505: Increase the length of the database field launchParms to 2048
ALTER TABLE course_bundle ALTER COLUMN launchParms nvarchar(2048)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241107-jw-1', 'Justin.wang', 'nschema/2502.changeLog.xml', GETDATE(), 885, '8:d44c30dfc4fe67d1819549b193cdcb3c', 'modifyDataType columnName=launchParms, tableName=course_bundle', 'PLC-505: Increase the length of the database field launchParms to 2048', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241203-rn-1::ronald.ng
-- PL-8381 - Remove finished scheduled reports
CREATE NONCLUSTERED INDEX NUK_BATCHREPORT_SCHE_REPORT_ID ON batchreport(schedule_report_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241203-rn-1', 'ronald.ng', 'nschema/2502.changeLog.xml', GETDATE(), 886, '8:4128cd206011d8cb251912ef73bbce7d', 'createIndex indexName=NUK_BATCHREPORT_SCHE_REPORT_ID, tableName=batchreport', 'PL-8381 - Remove finished scheduled reports', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241208-yf-1::yueqin.feng
-- PL-8450: update availability column for Programs
ALTER TABLE sessiondetail ALTER COLUMN availability nvarchar(1)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'sessiondetail'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.sessiondetail'; DECLARE @ColumnName SYSNAME set @ColumnName = N'availability'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Waitlist Handling option';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE sessiondetail ALTER COLUMN availability nvarchar(1) NOT NULL
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241208-yf-1', 'yueqin.feng', 'nschema/2502.changeLog.xml', GETDATE(), 887, '8:a293e9a521328a5df7fc4711017967b0', 'modifyDataType columnName=availability, tableName=sessiondetail; setColumnRemarks columnName=availability, tableName=sessiondetail; addNotNullConstraint columnName=availability, tableName=sessiondetail', 'PL-8450: update availability column for Programs', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241211-yf-1::yueqin.feng
-- PL-8309: Slack Workspace Configuration Settings
CREATE TABLE slack_workspace (id nvarchar(15) NOT NULL, display_name nvarchar(255) NOT NULL, description nvarchar(255), slack_workspace_name nvarchar(50) NOT NULL, slack_oauth_bot_token nvarchar(255) NOT NULL, is_active char(1) CONSTRAINT DF_slack_workspace_is_active DEFAULT 'Y' NOT NULL, CONSTRAINT PK_SLACK_WORKSPACE PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.slack_workspace';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores slack workspace configurations';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'slack workspace ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'slack workspace display name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'description'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'slack workspace description';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'slack_workspace_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'slack workspace name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'slack_oauth_bot_token'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'slack application oauth bot token';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'slack_workspace'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.slack_workspace'; DECLARE @ColumnName SYSNAME set @ColumnName = N'is_active'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Whether the slack workspace is active or not';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241211-yf-1', 'yueqin.feng', 'nschema/2502.changeLog.xml', GETDATE(), 888, '8:481fed967fdad0e6bf15a118b7d8a724', 'createTable tableName=slack_workspace', 'PL-8309: Slack Workspace Configuration Settings', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20241219-en-1::eddie.ng
-- PL-8311 [Slack Notifications] Add Notifications Tab to allow users to configure Slack notifications
CREATE TABLE user_notification (user_id nvarchar(85) NOT NULL, enable_slack char(1) CONSTRAINT DF_user_notification_enable_slack DEFAULT 'N' NOT NULL, slack_send_to smallint CONSTRAINT DF_user_notification_slack_send_to DEFAULT 0 NOT NULL, slack_workspace_id nvarchar(15), CONSTRAINT PK_USER_NOTIFICATION PRIMARY KEY (user_id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.user_notification';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores notification settings of users';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'enable_slack'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Enable Slack Notifications';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'slack_send_to'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Select notifications to send to Slack';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'slack_workspace_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Slack workspace ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE user_notification ADD CONSTRAINT FK_UN_UID FOREIGN KEY (user_id) REFERENCES users_assignment (userid)
GO

ALTER TABLE user_notification ADD CONSTRAINT FK_UN_SWS FOREIGN KEY (slack_workspace_id) REFERENCES slack_workspace (id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20241219-en-1', 'eddie.ng', 'nschema/2502.changeLog.xml', GETDATE(), 889, '8:e9b62ce206d9fb8d7575102bb3dbf2b6', 'createTable tableName=user_notification; addForeignKeyConstraint baseTableName=user_notification, constraintName=FK_UN_UID, referencedTableName=users_assignment; addForeignKeyConstraint baseTableName=user_notification, constraintName=FK_UN_SWS, re...', 'PL-8311 [Slack Notifications] Add Notifications Tab to allow users to configure Slack notifications', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20250115-yf-1::yueqin.feng
-- PL-8589: Cohort-support Enhancements
ALTER TABLE registration DROP CONSTRAINT UK_REGISTRATION
GO

ALTER TABLE registration ADD learningid nvarchar(85)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'registration'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.registration'; DECLARE @ColumnName SYSNAME set @ColumnName = N'learningid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The learning id of the learning object, it could be null for a non-program registration entry';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE registration ADD CONSTRAINT UK_REGISTRATION UNIQUE (learningid, eventid, user_meta_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250115-yf-1', 'yueqin.feng', 'nschema/2502.changeLog.xml', GETDATE(), 890, '8:2e7e6d7a582f91d3954a9b93fed357ab', 'dropUniqueConstraint constraintName=UK_REGISTRATION, tableName=registration; addColumn tableName=registration; addUniqueConstraint constraintName=UK_REGISTRATION, tableName=registration', 'PL-8589: Cohort-support Enhancements', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20250210-rli-1::richard.li
-- New table to store competency history
CREATE TABLE user_competency_history (id nvarchar(85) NOT NULL, event nvarchar(1) NOT NULL, history_comment nvarchar(2000), upload_file_name nvarchar(255), ekp_file_name nvarchar(50), proficiency_level_id nvarchar(15), created_date datetime NOT NULL, created_by nvarchar(85) NOT NULL, request_by nvarchar(85), deleted nvarchar(1) CONSTRAINT DF_user_competency_history_deleted DEFAULT 'N' NOT NULL, user_id nvarchar(85) NOT NULL, competency_id nvarchar(15) NOT NULL, date_assigned datetime, assigned_by nvarchar(85), assessment_mode char(1), assigned_comment nvarchar(1000), competency_level_id nvarchar(15), expire_date datetime, edit_source nvarchar(1) CONSTRAINT DF_user_competency_history_edit_source DEFAULT 'N' NOT NULL, CONSTRAINT PK_USER_COMPETENCY_HISTORY PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.user_competency_history';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores competency history';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Record';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'event'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Event Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'history_comment'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Comments';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'upload_file_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Guest Upload file name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'ekp_file_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Stored file name in file repository - UUID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'proficiency_level_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User selected ID proficiency level when creating history';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Record created Datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of creator';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'request_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Request User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'deleted'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Indicate whether this record is revoked or expired history, or is changed history by editing revoked or expired history';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'competency_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Competency';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'date_assigned'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User awarded competency datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assigned_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of competency assigner';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assessment_mode'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Assessment mode';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'assigned_comment'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User competency assign comment';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'competency_level_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of user awarded competency level';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'expire_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User Competency expire datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_competency_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_competency_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'edit_source'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Indicate the edit source of Changed event:               ''N'' - default(applicable for all of event except Changed);               ''R'' - edit a revoked history in UI;               ''E'' - edit a expired history in UI;               ''P'' - update proficiency of awarded competency in UI or created / updated via history dataloader';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE user_competency_history ADD CONSTRAINT FK_USER_COMP_HISTORY_USER_ID FOREIGN KEY (user_id) REFERENCES users_assignment (userid)
GO

ALTER TABLE user_competency_history ADD CONSTRAINT FK_USER_COMP_HISTORY_COMP_ID FOREIGN KEY (competency_id) REFERENCES individual_competency (id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250210-rli-1', 'richard.li', 'nschema/2502.changeLog.xml', GETDATE(), 891, '8:02c78d3bda73690ae059a917f8bb6a46', 'createTable tableName=user_competency_history; addForeignKeyConstraint baseTableName=user_competency_history, constraintName=FK_USER_COMP_HISTORY_USER_ID, referencedTableName=users_assignment; addForeignKeyConstraint baseTableName=user_competency_...', 'New table to store competency history', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20250210-rli-2::richard.li
-- New view of user competency with most recent history event
CREATE VIEW user_competency_history_vw AS SELECT uch.id
				,uch.event
				,uch.history_comment
				,uch.upload_file_name
				,uch.ekp_file_name
				,uch.proficiency_level_id
				,uch.created_date
				,uch.created_by
				,uch.request_by
				,uch.deleted
				,uch.user_id
				,uch.competency_id
				,uch.date_assigned
				,uch.assigned_by
				,uch.assessment_mode
				,uch.assigned_comment
				,uch.competency_level_id
				,uch.expire_date
				,uch.edit_source
				,m.history_count
			FROM user_competency_history uch
			JOIN (
				SELECT user_id
					,competency_id
					,MAX(created_date) AS created_date
					,COUNT(*) AS history_count
				FROM user_competency_history
				GROUP BY user_id, competency_id
			) m ON uch.user_id = m.user_id
				AND uch.competency_id = m.competency_id
				AND uch.created_date = m.created_date
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250210-rli-2', 'richard.li', 'nschema/2502.changeLog.xml', GETDATE(), 892, '8:761fea6b65b7971ebf9c3952aac5916f', 'createView viewName=user_competency_history_vw', 'New view of user competency with most recent history event', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20250210-rli-4::richard.li
-- New table to store user certification history
CREATE TABLE certusers_history (id nvarchar(85) NOT NULL, event nvarchar(2) NOT NULL, history_comment nvarchar(2000), upload_file_name nvarchar(255), ekp_file_name nvarchar(50), created_date datetime NOT NULL, created_by nvarchar(85) NOT NULL, request_by nvarchar(85), awardid nvarchar(85), userid nvarchar(85), certid numeric(8, 0), dateachieved datetime, comments nvarchar(255), awardedby nvarchar(85), expiredate datetime, status char(1), testinstanceid nvarchar(15), learningid nvarchar(85), cert_code nvarchar(85), cert_title nvarchar(4000), user_currentpid nvarchar(85), course_name nvarchar(4000), course_duration_comments nvarchar(255), course_startdate datetime, course_enddate datetime, user_locale smallint, course_module_description nvarchar(MAX), course_session_title nvarchar(255), course_facility_code nvarchar(255), tran_updater_legal_name nvarchar(250), tran_update_meaning_text nvarchar(500), tran_last_updated datetime, course_performance_grade smallint, user_givenname nvarchar(85), user_familyname nvarchar(85), user_employeeno nvarchar(85), user_jobtitle nvarchar(85), user_dateofbirth datetime, user_address1 nvarchar(150), user_address2 nvarchar(150), user_city nvarchar(50), task_approver_givenname nvarchar(85), task_approver_familyname nvarchar(85), cert_template_id nvarchar(85), display_learning_id nvarchar(85), tran_score nvarchar(20), tran_credits float(53), user_department_name nvarchar(85), self_award_certificate char(1) CONSTRAINT DF_certusers_history_self_award_certificate DEFAULT 'N', selfaward_attach_id nvarchar(85), CONSTRAINT PK_CERTUSERS_HISTORY PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.certusers_history';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores user certification history';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Record';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'event'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Event Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'history_comment'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Comments';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'upload_file_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Guest Upload file name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'ekp_file_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Stored file name in file repository - UUID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Record created Datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'created_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of creator';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'request_by'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Request User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'awardid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of this award';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'userid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'certid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of certification';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'dateachieved'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User awarded certification datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'comments'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User certification award comment';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'awardedby'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of certification awarder';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'expiredate'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'User certification expire datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'status'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Status';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'testinstanceid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Test instance';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'learningid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'ID of Learning Object';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'cert_code'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Certification Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'cert_title'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Certification Title';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_currentpid'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'CurrentPID of User';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_duration_comments'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course duration comments';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_startdate'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course start datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_enddate'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course end datetime';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_locale'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s User Perference locale';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_module_description'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course Module Description';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_session_title'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course Session title';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_facility_code'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course Facility Code';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tran_updater_legal_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Transcript Updater''s legal name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tran_update_meaning_text'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Transcript Update Meaning';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tran_last_updated'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Transcript Signed Date';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'course_performance_grade'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Course Performance Grade';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_givenname'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s First Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_familyname'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Last Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_employeeno'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Employee Number';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_jobtitle'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Job Title';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_dateofbirth'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Date of Birth';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_address1'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Address 1';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_address2'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Address 2';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_city'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s City';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'task_approver_givenname'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Task Approver''s Given Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'task_approver_familyname'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Task Approver''s Family Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'cert_template_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Certification Template Id, Ekp File Revision Id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_learning_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learning Object''s display Id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tran_score'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'transcript Score';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tran_credits'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Transcript Credits';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'user_department_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Learner''s Department Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'self_award_certificate'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'flag if the certificate awarded is self awarded';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'certusers_history'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.certusers_history'; DECLARE @ColumnName SYSNAME set @ColumnName = N'selfaward_attach_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'self award certificate attachment id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250210-rli-4', 'richard.li', 'nschema/2502.changeLog.xml', GETDATE(), 893, '8:59298b62de9c6b19ecbc1127e8104497', 'createTable tableName=certusers_history', 'New table to store user certification history', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2502.changeLog.xml::20250210-rli-5::richard.li
-- New view of user certification with most recent history event
CREATE VIEW certusers_history_vw AS SELECT id
				  ,ch.event
				  ,ch.history_comment
				  ,ch.upload_file_name
				  ,ch.ekp_file_name
				  ,ch.created_date
				  ,ch.created_by
				  ,ch.request_by
				  ,ch.awardid
				  ,ch.userid
				  ,ch.certid
				  ,ch.dateachieved
				  ,ch.comments
				  ,ch.awardedby
				  ,ch.expiredate
				  ,ch.status
				  ,ch.testinstanceid
				  ,ch.learningid
				  ,ch.cert_code
				  ,ch.cert_title
				  ,ch.user_currentpid
				  ,ch.course_name
				  ,ch.course_duration_comments
				  ,ch.course_startdate
				  ,ch.course_enddate
				  ,ch.user_locale
				  ,ch.course_module_description
				  ,ch.course_session_title
				  ,ch.course_facility_code
				  ,ch.tran_updater_legal_name
				  ,ch.tran_update_meaning_text
				  ,ch.tran_last_updated
				  ,ch.course_performance_grade
				  ,ch.user_givenname
				  ,ch.user_familyname
				  ,ch.user_employeeno
				  ,ch.user_jobtitle
				  ,ch.user_dateofbirth
				  ,ch.user_address1
				  ,ch.user_address2
				  ,ch.user_city
				  ,ch.task_approver_givenname
				  ,ch.task_approver_familyname
				  ,ch.cert_template_id
				  ,ch.display_learning_id
				  ,ch.tran_score
				  ,ch.tran_credits
				  ,ch.user_department_name
				  ,ch.self_award_certificate
				  ,ch.selfaward_attach_id
				  ,m.history_count
			FROM certusers_history ch
			JOIN (
                SELECT userid, certid, MAX(created_date) AS created_date, COUNT(*) AS history_count
				FROM certusers_history
				GROUP BY userid, certid
			) m ON ch.userid = m.userid AND ch.certid = m.certid AND ch.created_date = m.created_date
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250210-rli-5', 'richard.li', 'nschema/2502.changeLog.xml', GETDATE(), 894, '8:2950a1d92395eb4b90f2b0d05a947d98', 'createView viewName=certusers_history_vw', 'New view of user certification with most recent history event', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250225-em-1::emmar.masagca
UPDATE ekpversion SET dblevel = 2506, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250225-em-1', 'emmar.masagca', 'nschema/2506.changeLog.xml', GETDATE(), 895, '8:7baa1af5a79a1dbe1348cd3d2adcdbaa', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250321-rn-1::ronald.ng
-- NSD-9926 - Website unresponsive with queued queries
CREATE NONCLUSTERED INDEX NUK_TRAN_LEARNINGID_EVENTID ON transcript(learningid, eventid)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250321-rn-1', 'ronald.ng', 'nschema/2506.changeLog.xml', GETDATE(), 896, '8:5c2197ff888c3356a0a97587304e5301', 'createIndex indexName=NUK_TRAN_LEARNINGID_EVENTID, tableName=transcript', 'NSD-9926 - Website unresponsive with queued queries', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250408-jj-1::jim.johnson
-- NSD-9907 - Change of field length for "Company name"
ALTER TABLE users_meta ALTER COLUMN b_companyname nvarchar(255)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250408-jj-1', 'jim.johnson', 'nschema/2506.changeLog.xml', GETDATE(), 897, '8:faee2762f9da8e4e011ee6b2edc96839', 'modifyDataType columnName=b_companyname, tableName=users_meta', 'NSD-9907 - Change of field length for "Company name"', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250408-jj-2::jim.johnson
-- NSD-9882 - Change of field length for string_id
ALTER TABLE language_custom_string DROP CONSTRAINT PK_LANG_CUST_STR
GO

ALTER TABLE language_custom_string ALTER COLUMN string_id nvarchar(85) NULL
GO

ALTER TABLE language_custom_string ALTER COLUMN string_id nvarchar(255)
GO

ALTER TABLE language_custom_string ALTER COLUMN string_id nvarchar(255) NOT NULL
GO

ALTER TABLE language_custom_string ADD CONSTRAINT PK_LANG_CUST_STR PRIMARY KEY (locale_file_id, string_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250408-jj-2', 'jim.johnson', 'nschema/2506.changeLog.xml', GETDATE(), 898, '8:53b266f659cddf0e3e59fd0883ba3e9d', 'dropPrimaryKey constraintName=PK_LANG_CUST_STR, tableName=language_custom_string; dropNotNullConstraint columnName=string_id, tableName=language_custom_string; modifyDataType columnName=string_id, tableName=language_custom_string; addNotNullConstr...', 'NSD-9882 - Change of field length for string_id', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250408-jj-3::jim.johnson
-- NSD-9951 - Add indexes from Bombardier R140 issue to PFL release 25.06
CREATE NONCLUSTERED INDEX NUK_COURSE_COMP_EXP_COMP_ID
            ON course_competency_exp (competency_id)
            INCLUDE (course_id, user_id, expiry_date)
GO

CREATE NONCLUSTERED INDEX NUK_EQUIV_TARGET_SUB_RULE ON equivalency_rules(target_id, substitute_id, rule_group_id)
GO

CREATE NONCLUSTERED INDEX NUK_TRAN_LID_INCL_UID_ENRDATE
            ON transcript (learningid)
            INCLUDE (userid, enrollmentDate)
GO

DROP INDEX NUK_TRAN_LID ON transcript
GO

CREATE NONCLUSTERED INDEX NUK_TRAN_LID
            ON transcript (learningid, eventid, studentstatus, isOpen, userid)
            INCLUDE (enrollmentDate)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250408-jj-3', 'jim.johnson', 'nschema/2506.changeLog.xml', GETDATE(), 899, '8:a2d55709b1c99a5c9c99e5cf45c2d9b9', 'sql; createIndex indexName=NUK_EQUIV_TARGET_SUB_RULE, tableName=equivalency_rules; sql; dropIndex indexName=NUK_TRAN_LID, tableName=transcript; sql', 'NSD-9951 - Add indexes from Bombardier R140 issue to PFL release 25.06', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250417-rli-1::richard.li
-- New view of creator of user certification history, the creator can be User/Learning Object/Group/'System'
CREATE VIEW certusers_history_creator_vw AS SELECT ch.id,
                CASE
                    WHEN u.currentPID IS NOT NULL THEN u.currentPID
                    WHEN lo.display_learning_id IS NOT NULL THEN lo.display_learning_id
                    WHEN jpg.name IS NOT NULL THEN jpg.name
                    WHEN cg.name IS NOT NULL THEN cg.name
                ELSE ch.created_by
                END AS taken_by
            FROM certusers_history ch
            LEFT JOIN valid_users_vw u ON ch.created_by = u.userid
            LEFT JOIN learningObject lo on ch.created_by = lo.learningid
            LEFT JOIN job_profile_group jpg on ch.created_by = jpg.id
            LEFT JOIN competency_group cg on ch.created_by = cg.id
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250417-rli-1', 'richard.li', 'nschema/2506.changeLog.xml', GETDATE(), 900, '8:18c830108472589edd756c0f66845bc4', 'createView viewName=certusers_history_creator_vw', 'New view of creator of user certification history, the creator can be User/Learning Object/Group/''System''', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250417-rli-2::richard.li
-- New view of creator of user competency history, the creator can be User/Learning Object/'System'
CREATE VIEW user_comp_history_creator_vw AS SELECT uch.id,
                CASE
                    WHEN u.currentPID IS NOT NULL THEN u.currentPID
                    WHEN lo.display_learning_id IS NOT NULL THEN lo.display_learning_id
                ELSE uch.created_by
                END AS taken_by
            FROM user_competency_history uch
            LEFT JOIN valid_users_vw u ON uch.created_by = u.userid
            LEFT JOIN learningObject lo on uch.created_by = lo.learningid
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250417-rli-2', 'richard.li', 'nschema/2506.changeLog.xml', GETDATE(), 901, '8:538d0b575e3f0d8a0bec3253a28407da', 'createView viewName=user_comp_history_creator_vw', 'New view of creator of user competency history, the creator can be User/Learning Object/''System''', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250507-rli-1::richard.li
-- PLC-702 Add awardid in GROUP BY
ALTER VIEW certusers_history_vw AS SELECT id
                   ,ch.event
                   ,ch.history_comment
                   ,ch.upload_file_name
                   ,ch.ekp_file_name
                   ,ch.created_date
                   ,ch.created_by
                   ,ch.request_by
                   ,ch.awardid
                   ,ch.userid
                   ,ch.certid
                   ,ch.dateachieved
                   ,ch.comments
                   ,ch.awardedby
                   ,ch.expiredate
                   ,ch.status
                   ,ch.testinstanceid
                   ,ch.learningid
                   ,ch.cert_code
                   ,ch.cert_title
                   ,ch.user_currentpid
                   ,ch.course_name
                   ,ch.course_duration_comments
                   ,ch.course_startdate
                   ,ch.course_enddate
                   ,ch.user_locale
                   ,ch.course_module_description
                   ,ch.course_session_title
                   ,ch.course_facility_code
                   ,ch.tran_updater_legal_name
                   ,ch.tran_update_meaning_text
                   ,ch.tran_last_updated
                   ,ch.course_performance_grade
                   ,ch.user_givenname
                   ,ch.user_familyname
                   ,ch.user_employeeno
                   ,ch.user_jobtitle
                   ,ch.user_dateofbirth
                   ,ch.user_address1
                   ,ch.user_address2
                   ,ch.user_city
                   ,ch.task_approver_givenname
                   ,ch.task_approver_familyname
                   ,ch.cert_template_id
                   ,ch.display_learning_id
                   ,ch.tran_score
                   ,ch.tran_credits
                   ,ch.user_department_name
                   ,ch.self_award_certificate
                   ,ch.selfaward_attach_id
                   ,m.history_count
            FROM certusers_history ch
            JOIN (
                SELECT userid, certid, awardid, MAX(created_date) AS created_date, COUNT(*) AS history_count
                  FROM certusers_history
                 GROUP BY userid, certid, awardid
            ) m ON ch.userid = m.userid AND ch.certid = m.certid AND ch.awardid = m.awardid AND ch.created_date = m.created_date
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250507-rli-1', 'richard.li', 'nschema/2506.changeLog.xml', GETDATE(), 902, '8:b33038111ccdafee880f9c447ddd79d9', 'alterView viewName=certusers_history_vw', 'PLC-702 Add awardid in GROUP BY', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250509-rli-1::richard.li
-- PLC-703 New view of user job competency with most recent history event
CREATE VIEW user_job_profile_comp_hist_vw AS SELECT ujp.user_id
				,jp.id AS job_profile_id
				,jp.name AS job_profile_name
				,c.name
				,rl.level_order
				,jpcrl.level_order AS target_level_order
                ,CASE WHEN uc.assessment_mode IS NOT NULL THEN uc.assessment_mode ELSE uchv.assessment_mode END AS assessment_mode
                ,CASE WHEN uc.assigned_by IS NOT NULL THEN uc.assigned_by ELSE uchv.assigned_by END AS assigned_by
                ,CASE WHEN uc.assigned_comment IS NOT NULL THEN uc.assigned_comment ELSE uchv.assigned_comment END AS assigned_comment
				,jpc.competency_id
				,jpc.competency_quota
                ,CASE WHEN uc.competency_level_id IS NOT NULL THEN uc.competency_level_id ELSE uchv.competency_level_id END AS competency_level_id
                ,CASE WHEN uc.date_assigned IS NOT NULL THEN uc.date_assigned ELSE uchv.date_assigned END AS date_assigned
				,rl.level_order - jpcrl.level_order AS gap
				,CASE
					WHEN rl.level_order IS NULL
						THEN 'N'
					WHEN jpcrl.level_order > rl.level_order
						THEN 'N'
					ELSE 'Y'
					END AS met
				,rl.code AS level_code
				,jpcrl.code AS target_level_code
				,jpc.competency_order
				,c.acquire_method
				,c.requires_all
				,c.n_completions_required
				,c.reference_code
				,c.description
				,uchv.event
				,uchv.created_date
				,uchv.edit_source
				,uchv.history_count
                ,uc.user_id AS uc_user_id
			FROM user_job_profile ujp
			LEFT OUTER JOIN job_profile_competency jpc ON ujp.job_profile_id = jpc.job_profile_id
			LEFT OUTER JOIN user_competency_history_vw uchv ON jpc.competency_id = uchv.competency_id
				AND ujp.user_id = uchv.user_id
            LEFT OUTER JOIN user_competency uc ON jpc.competency_id = uc.competency_id
                AND ujp.user_id = uc.user_id
			LEFT OUTER JOIN competency_level cl ON cl.id = uchv.competency_level_id
			LEFT OUTER JOIN tms_responsibility_level rl ON cl.res_id = rl.id
			LEFT OUTER JOIN competency_level jpcl ON jpcl.id = jpc.competency_target_level_id
			LEFT OUTER JOIN tms_responsibility_level jpcrl ON jpcrl.id = jpcl.res_id
			INNER JOIN individual_competency c ON jpc.competency_id = c.id
            INNER JOIN job_profile jp ON jp.id = ujp.job_profile_id
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250509-rli-1', 'richard.li', 'nschema/2506.changeLog.xml', GETDATE(), 903, '8:93892182b2f3580fc33298b5f72a52f4', 'createView viewName=user_job_profile_comp_hist_vw', 'PLC-703 New view of user job competency with most recent history event', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2506.changeLog.xml::20250610-ps-1::paul.strugnell
-- NSD-10021: New index to improve performance of R140 and Job Profile Competency Quota Analytics
CREATE NONCLUSTERED INDEX NUK_USERCOMPHIST_UID_CID_CDATE
            ON user_competency_history (user_id,competency_id,created_date)
            INCLUDE (deleted)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250610-ps-1', 'paul.strugnell', 'nschema/2506.changeLog.xml', GETDATE(), 904, '8:93a7cb6ae77aceed14a7dd58a7daf549', 'sql', 'NSD-10021: New index to improve performance of R140 and Job Profile Competency Quota Analytics', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2510.changeLog.xml::20250613-ps-1::paul.strugnell
UPDATE ekpversion SET dblevel = 2510, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250613-ps-1', 'paul.strugnell', 'nschema/2510.changeLog.xml', GETDATE(), 905, '8:33168bef092a27e463f6ea78de1c03f9', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2510.changeLog.xml::20250709-yf-1::yueqin.feng
-- PL-8487: [MS Teams Notifications] Teams App Configuration Settings
CREATE TABLE ms_teams_application (id nvarchar(15) NOT NULL, display_name nvarchar(255) NOT NULL, description nvarchar(255), client_id nvarchar(255) NOT NULL, client_secret nvarchar(255) NOT NULL, tenant_id nvarchar(255) NOT NULL, is_active char(1) CONSTRAINT DF_ms_teams_application_is_active DEFAULT 'Y' NOT NULL, CONSTRAINT PK_MS_TEAMS_APPLICATION PRIMARY KEY (id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME; SET @FullTableName = @DynamicSchemaName + N'.ms_teams_application';DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'This table stores microsoft teams application configurations';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.name = N'MS_Description' AND ep.minor_id=0); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application display name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'description'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application description';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'client_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application client id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'client_secret'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application client secret';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tenant_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'microsoft teams application tenant id';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'ms_teams_application'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.ms_teams_application'; DECLARE @ColumnName SYSNAME set @ColumnName = N'is_active'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'whether the microsoft teams application is active or not';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250709-yf-1', 'yueqin.feng', 'nschema/2510.changeLog.xml', GETDATE(), 906, '8:b60e6f9be9cfb2cc0f1d11c5b405023c', 'createTable tableName=ms_teams_application', 'PL-8487: [MS Teams Notifications] Teams App Configuration Settings', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2510.changeLog.xml::20250720-yf-1::yueqin.feng
-- PL-8485: [MS Teams Notifications] Add Notifications Tab to allow users to configure Teams notifications
ALTER TABLE user_notification ADD enable_msteams char(1) CONSTRAINT DF_user_notification_enable_msteams DEFAULT 'N' NOT NULL
GO

ALTER TABLE user_notification ADD msteams_send_to smallint CONSTRAINT DF_user_notification_msteams_send_to DEFAULT 0 NOT NULL
GO

ALTER TABLE user_notification ADD msteams_app_id nvarchar(15)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'enable_msteams'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Enable Microsoft Teams Notifications';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'msteams_send_to'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Select notifications to send to Microsoft Teams';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'msteams_app_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Microsoft Teams App ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE user_notification ADD CONSTRAINT FK_UN_MSTA FOREIGN KEY (msteams_app_id) REFERENCES ms_teams_application (id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250720-yf-1', 'yueqin.feng', 'nschema/2510.changeLog.xml', GETDATE(), 907, '8:963196024897154d6793b3f3955c2d78', 'addColumn tableName=user_notification; addForeignKeyConstraint baseTableName=user_notification, constraintName=FK_UN_MSTA, referencedTableName=ms_teams_application', 'PL-8485: [MS Teams Notifications] Add Notifications Tab to allow users to configure Teams notifications', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2510.changeLog.xml::20250722-em-1::emmar.masagca
-- PL-9252 - Add refresh_token and request_date columns to user_notification
ALTER TABLE user_notification ADD ms_teams_refresh_token nvarchar(4000)
GO

ALTER TABLE user_notification ADD ms_teams_request_date datetime
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'ms_teams_refresh_token'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'MS Teams refresh token';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'user_notification'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.user_notification'; DECLARE @ColumnName SYSNAME set @ColumnName = N'ms_teams_request_date'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'MS Teams token request date';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20250722-em-1', 'emmar.masagca', 'nschema/2510.changeLog.xml', GETDATE(), 908, '8:b0832b16931474cca1d1f16ca341b413', 'addColumn tableName=user_notification', 'PL-9252 - Add refresh_token and request_date columns to user_notification', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251024-sc-1::shu.cui
UPDATE ekpversion SET dblevel = 2602, splevel = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251024-sc-1', 'shu.cui', 'nschema/2602.changeLog.xml', GETDATE(), 909, '8:860169a575d3de30d1750d105fa35742', 'update tableName=ekpversion', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251029-em-1::emmar.masagca
-- PL-1434 - This table stores Zoom account information
CREATE TABLE vc_zoom_account (account_id nvarchar(85) NOT NULL, display_name nvarchar(1000) NOT NULL, client_id nvarchar(255) NOT NULL, client_secret nvarchar(255) NOT NULL, tenant_id nvarchar(255) NOT NULL, zoom_user_id nvarchar(255) NOT NULL, CONSTRAINT PK_VC_ZOOM_ACCOUNT PRIMARY KEY (account_id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'account_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Primary key';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'display_name'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Display Name';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'client_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Client ID from Zoom';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'client_secret'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Client secret value from Zoom';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'tenant_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Tenant ID from Zoom';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'zoom_user_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Zoom User ID or sign in email address in Zoom';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251029-em-1', 'emmar.masagca', 'nschema/2602.changeLog.xml', GETDATE(), 910, '8:f852d814452b5853a0fe2473a5be4668', 'createTable tableName=vc_zoom_account', 'PL-1434 - This table stores Zoom account information', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251106-em-1::emmar.masagca
-- PL-1436 - Zoom Catalog Editor UI Changes
CREATE TABLE vc_launcher_zoom (course_id nvarchar(85) NOT NULL, zoom_account_id nvarchar(85) NOT NULL, last_updated datetime, updater_legal_name nvarchar(1000), update_meaning_text nvarchar(85), last_updater_uid nvarchar(85), CONSTRAINT PK_VC_LAUNCHER_ZOOM PRIMARY KEY (course_id))
GO

CREATE NONCLUSTERED INDEX idx_zoom_account_id ON vc_launcher_zoom(zoom_account_id)
GO

ALTER TABLE vc_launcher_zoom ADD CONSTRAINT FK_VCLAUZ_ACCOUNTID FOREIGN KEY (zoom_account_id) REFERENCES vc_zoom_account (account_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251106-em-1', 'emmar.masagca', 'nschema/2602.changeLog.xml', GETDATE(), 911, '8:4c39834435b7be1edd88c7a102f2679a', 'createTable tableName=vc_launcher_zoom; createIndex indexName=idx_zoom_account_id, tableName=vc_launcher_zoom; addForeignKeyConstraint baseTableName=vc_launcher_zoom, constraintName=FK_VCLAUZ_ACCOUNTID, referencedTableName=vc_zoom_account', 'PL-1436 - Zoom Catalog Editor UI Changes', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251107-em-1::emmar.masagca
-- PL-1436 - Zoom Catalog Editor UI Changes
CREATE TABLE vc_zoom_session (session_id nvarchar(15) NOT NULL, learning_id nvarchar(85) NOT NULL, update_history_status char(1), last_update_history_time datetime, last_update_history_uid nvarchar(85), CONSTRAINT PK_VC_ZOOM_SESSION PRIMARY KEY (session_id))
GO

ALTER TABLE vc_zoom_session ADD CONSTRAINT FK_VC_ZOOM_SESSION_SID FOREIGN KEY (session_id) REFERENCES cschedule (eventid)
GO

ALTER TABLE vc_zoom_session ADD CONSTRAINT FK_VC_ZOOM_SESSION_LID FOREIGN KEY (learning_id) REFERENCES learningObject (learningid)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251107-em-1', 'emmar.masagca', 'nschema/2602.changeLog.xml', GETDATE(), 912, '8:9bd221a625a929d0f99a6f2985634580', 'createTable tableName=vc_zoom_session; addForeignKeyConstraint baseTableName=vc_zoom_session, constraintName=FK_VC_ZOOM_SESSION_SID, referencedTableName=cschedule; addForeignKeyConstraint baseTableName=vc_zoom_session, constraintName=FK_VC_ZOOM_SE...', 'PL-1436 - Zoom Catalog Editor UI Changes', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251107-sc-1::shu.cui
-- PL-1436 - VILT - Create Zoom Meeting via Virtual Meeting Service
CREATE TABLE vc_zoom_meeting (meeting_id nvarchar(85) NOT NULL, event_id nvarchar(15), session_id nvarchar(15) NOT NULL, sync_status char(1), zoom_meeting_id numeric(19, 0), topic nvarchar(200), start_time datetime, duration int, timezone nvarchar(50), start_url nvarchar(1024), start_url_expiry_time datetime, join_url nvarchar(1024), registration_url nvarchar(1024), CONSTRAINT PK_VC_ZOOM_MEETING PRIMARY KEY (meeting_id))
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'meeting_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Primary key';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'event_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Module session event ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'session_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Module session ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'sync_status'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Zoom meeting sync status';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'zoom_meeting_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Meeting ID returned from Zoom';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'topic'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Meeting topic';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'start_time'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Meeting start time';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'duration'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Meeting duration in minutes';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'timezone'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Meeting timezone ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'start_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'the URL a host uses to start a meeting';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'start_url_expiry_time'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'the start URL expiry time';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'join_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'the URL to join a meeting';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'registration_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'the URL participants use to register a meeting';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE vc_zoom_meeting ADD CONSTRAINT FK_VC_ZOOM_MEETING_EID FOREIGN KEY (event_id) REFERENCES module_session_schedule (eventid)
GO

ALTER TABLE vc_zoom_meeting ADD CONSTRAINT FK_VC_ZOOM_MEETING_SID FOREIGN KEY (session_id) REFERENCES cschedule (eventid)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251107-sc-1', 'shu.cui', 'nschema/2602.changeLog.xml', GETDATE(), 913, '8:e87fe4fa3d25a4ad997f509e867f0fe0', 'createTable tableName=vc_zoom_meeting; addForeignKeyConstraint baseTableName=vc_zoom_meeting, constraintName=FK_VC_ZOOM_MEETING_EID, referencedTableName=module_session_schedule; addForeignKeyConstraint baseTableName=vc_zoom_meeting, constraintName...', 'PL-1436 - VILT - Create Zoom Meeting via Virtual Meeting Service', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251209-jj-1::jim.johnson
-- NSD-10262 Increase interaction_id to VARCHAR(4000)
DROP INDEX NUK_AICCINT ON AICC_interactions
GO

ALTER TABLE AICC_interactions ALTER COLUMN interaction_id nvarchar(4000)
GO

CREATE NONCLUSTERED INDEX NUK_AICCINT ON AICC_interactions(session_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251209-jj-1', 'jim.johnson', 'nschema/2602.changeLog.xml', GETDATE(), 914, '8:b8db69812b4f05631419897de9f92d43', 'dropIndex indexName=NUK_AICCINT, tableName=AICC_interactions; modifyDataType columnName=interaction_id, tableName=AICC_interactions; createIndex indexName=NUK_AICCINT, tableName=AICC_interactions', 'NSD-10262 Increase interaction_id to VARCHAR(4000)', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20251211-sc-1::shu.cui
-- PL-1437 VILT - Register user in Zoom Meeting during Enrollment via Virtual Meeting Service
CREATE TABLE vc_zoom_registrant (transcript_id nvarchar(15) NOT NULL, registrant_id nvarchar(30) NOT NULL, zoom_meeting_id numeric(19, 0) NOT NULL, join_url nvarchar(1024) NOT NULL)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_registrant'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_registrant'; DECLARE @ColumnName SYSNAME set @ColumnName = N'transcript_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Transcript ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_registrant'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_registrant'; DECLARE @ColumnName SYSNAME set @ColumnName = N'registrant_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'The meeting registrant ID.';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_registrant'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_registrant'; DECLARE @ColumnName SYSNAME set @ColumnName = N'zoom_meeting_id'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Zoom Meeting ID';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_registrant'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_registrant'; DECLARE @ColumnName SYSNAME set @ColumnName = N'join_url'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'the URL to join a meeting';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

ALTER TABLE vc_zoom_registrant ADD CONSTRAINT PK_VC_ZOOM_REGISTRANT PRIMARY KEY (transcript_id, zoom_meeting_id)
GO

ALTER TABLE vc_zoom_registrant ADD CONSTRAINT FK_VC_ZOOM_REGISTRANT_TID FOREIGN KEY (transcript_id) REFERENCES transcript (transcriptid)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20251211-sc-1', 'shu.cui', 'nschema/2602.changeLog.xml', GETDATE(), 915, '8:5216ad2dffd3ab86c457c725e3ef565b', 'createTable tableName=vc_zoom_registrant; addPrimaryKey constraintName=PK_VC_ZOOM_REGISTRANT, tableName=vc_zoom_registrant; addForeignKeyConstraint baseTableName=vc_zoom_registrant, constraintName=FK_VC_ZOOM_REGISTRANT_TID, referencedTableName=tra...', 'PL-1437 VILT - Register user in Zoom Meeting during Enrollment via Virtual Meeting Service', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20260120-ps-1::paul.strugnell
-- PL-9769: add index to registration table (follow-up to NSD-10413)
CREATE NONCLUSTERED INDEX nuk_reg_eventid_user_meta_id ON registration(eventid, user_meta_id)
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20260120-ps-1', 'paul.strugnell', 'nschema/2602.changeLog.xml', GETDATE(), 916, '8:4a39e9d17051626e30535fee7c088ec5', 'createIndex indexName=nuk_reg_eventid_user_meta_id, tableName=registration', 'PL-9769: add index to registration table (follow-up to NSD-10413)', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20260116-em-1::emmar.masagca
-- PL-1445 - Add archive_recordings column to vc_zoom_account (Y/N)
ALTER TABLE vc_zoom_account ADD archive_recordings char(1) CONSTRAINT DF_vc_zoom_account_archive_recordings DEFAULT 'N' NOT NULL
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_account'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_account'; DECLARE @ColumnName SYSNAME set @ColumnName = N'archive_recordings'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Indicates if recordings should be archived (Y/N)';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20260116-em-1', 'emmar.masagca', 'nschema/2602.changeLog.xml', GETDATE(), 917, '8:5c7f85b3c0c8b98ae2dce0f6a5d48447', 'addColumn tableName=vc_zoom_account', 'PL-1445 - Add archive_recordings column to vc_zoom_account (Y/N)', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/2602.changeLog.xml::20260120-em-1::emmar.masagca
-- PL-1445 - Add download_recording_status column to vc_zoom_meeting
ALTER TABLE vc_zoom_meeting ADD download_recording_status char(1)
GO

DECLARE @DynamicSchemaName SYSNAME set @DynamicSchemaName = SCHEMA_NAME();
DECLARE @TableName SYSNAME set @TableName = N'vc_zoom_meeting'; DECLARE @FullTableName SYSNAME set @FullTableName = @DynamicSchemaName + N'.vc_zoom_meeting'; DECLARE @ColumnName SYSNAME set @ColumnName = N'download_recording_status'; DECLARE @MS_DescriptionValue NVARCHAR(3749); SET @MS_DescriptionValue = N'Status of recording download';DECLARE @MS_Description NVARCHAR(3749) set @MS_Description = NULL; SET @MS_Description = (SELECT CAST(Value AS NVARCHAR(3749)) AS [MS_Description] FROM sys.extended_properties AS ep WHERE ep.major_id = OBJECT_ID(@FullTableName) AND ep.minor_id=COLUMNPROPERTY(ep.major_id, @ColumnName, 'ColumnId') AND ep.name = N'MS_Description'); IF @MS_Description IS NULL BEGIN EXEC sys.sp_addextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END ELSE BEGIN EXEC sys.sp_updateextendedproperty @name  = N'MS_Description', @value = @MS_DescriptionValue, @level0type = N'SCHEMA', @level0name = @DynamicSchemaName, @level1type = N'TABLE', @level1name = @TableName, @level2type = N'COLUMN', @level2name = @ColumnName; END
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20260120-em-1', 'emmar.masagca', 'nschema/2602.changeLog.xml', GETDATE(), 918, '8:feb38f38764c145265038ca0f2c2d13e', 'addColumn tableName=vc_zoom_meeting', 'PL-1445 - Add download_recording_status column to vc_zoom_meeting', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20140117-sg-01::shravan
INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('INITIALIZED', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('60_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('60_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('60_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('60_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('61_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('61_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('61_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('62_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('62_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('63_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('63_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('63_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('63_7;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('70_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('70_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('70_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('70_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('71_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('71_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('71_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('72_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('80_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('82_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('83_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('90_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('90_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('90_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('90_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('90_6;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_6;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_7;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_8;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_9;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_10;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_11;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_12;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_13;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('91_14;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('92_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('92_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('92_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('92_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('93_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('93_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('93_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('93_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('100_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('100_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('100_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('100_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('100_6;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('101_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('101_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('101_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('101_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('101_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('102_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('102_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('102_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('102_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('102_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('103_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('110_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_2;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_3;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_4;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_5;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_6;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('111_7;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1111_1;', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1111_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1111_3', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1111_4', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1112_1', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1112_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('112_0', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('112_1', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('112_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('1121_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('121_7', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('122_1', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('122_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('122_5', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('122_6', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('130_2', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('131_1', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('131_5', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('131_6', GETDATE())
GO

INSERT INTO system_migration_tasks (taskid, action_date) VALUES ('140_1', GETDATE())
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20140117-sg-01', 'shravan', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 919, '8:ff0dd506d5ae23291526f337556b9088', 'insert tableName=system_migration_tasks; insert tableName=system_migration_tasks; insert tableName=system_migration_tasks; insert tableName=system_migration_tasks; insert tableName=system_migration_tasks; insert tableName=system_migration_tasks; i...', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20150122-sg-01::shravan.gurrala
INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20150122-sg-01', 'shravan.gurrala', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 920, '8:d41d8cd98f00b204e9800998ecf8427e', 'empty', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20150423-dc-01::dennis.cheung
DELETE FROM code_itemLanguage
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20150423-dc-01', 'dennis.cheung', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 921, '8:46ff72ccfa606a2e12a677aeacfaa466', 'delete tableName=code_itemLanguage', '', 'EXECUTED', NULL, NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20200908-yf-02::yueqin.feng
-- PL-375: Replacement Default Skin
UPDATE screenLayout SET bottomContent = 0, bottomHeight = '0', bottomMenu = 100, bottomStylesheet = 'bottom.css', bottomTX = NULL, description = 'PeopleFluent_LMS_Default', directory = 'lms-skin', displaySearchBox = 'Y', fixed_width = 0, frameless = 'Y', homeTX = 'WIDGETCONTAINERPAGE', homepage_template = 'DEFAULTTEMPLATE', iconset = 0, language = 0, layout = 4, leftContent = 0, leftMenu = 100, leftStylesheet = 'left.css', leftTX = NULL, leftWidth = '0', mainContent = 0, mainMenu = 100, mainStylesheet = 'main.css', menu_position = 'N', mouseovermenu = 'Y', right_to_left = 'N', shortname = 'PeopleFluent_LMS_Default', showteachbutton = 'Y', topContent = 0, topHeight = '0', topMenu = 100, topStylesheet = 'top.css', topTX = NULL, usetab = 'Y' WHERE ui = 0
GO

DELETE FROM screenLayout WHERE ui = 15
GO

DELETE FROM permissions WHERE objecttype='SKIN' AND objectid='15'
GO

DELETE FROM permission_mapping WHERE objecttype='SKIN' AND objectid='15'
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20200908-yf-02', 'yueqin.feng', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 922, '8:16e02e8fbe693d7ea4f7ae5180412127', 'update tableName=screenLayout; delete tableName=screenLayout; delete tableName=permissions; delete tableName=permission_mapping', 'PL-375: Replacement Default Skin', 'EXECUTED', '93', NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20201102-yf-02::yueqin.feng
-- PL-600: Make new home page default home page
UPDATE screenLayout SET homeTX = 'HOMEPAGE' WHERE ui = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20201102-yf-02', 'yueqin.feng', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 923, '8:cbb258eb7defd3be180cf321f9f9a28b', 'update tableName=screenLayout', 'PL-600: Make new home page default home page', 'EXECUTED', '93', NULL, '4.8.0', '1515184631')
GO

-- Changeset nschema/sys.initializer.changeLog.xml::20240906-yf-01::yueqin.feng
-- PL-7868: Backend Prep for New Skin Release
UPDATE screenLayout SET legacymode = 'N', mouseovermenu = 'N', navigation_style = 'left', primary_color = '#1F3055', secondary_color = '#2A4072' WHERE ui = 0
GO

INSERT INTO DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, DESCRIPTION, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('20240906-yf-01', 'yueqin.feng', 'nschema/sys.initializer.changeLog.xml', GETDATE(), 924, '8:aad5fc47157953777d7acb08c2b928eb', 'update tableName=screenLayout', 'PL-7868: Backend Prep for New Skin Release', 'EXECUTED', '93', NULL, '4.8.0', '1515184631')
GO

-- Release Database Lock
UPDATE DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
GO

