From 5ecd7f5bbd2e866999e1eb698710babb2cad7b96 Mon Sep 17 00:00:00 2001 From: Stephen Vickers Date: Sat, 5 Mar 2022 10:28:43 +0000 Subject: [PATCH] Update Unique constraints in table definitions for SQL Server Replace unique constraint with unique unique filtered index to allow null values to be ignored. --- sql/lti4-platform-mssql.sql | 2 +- sql/lti4-tables-mssql.sql | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sql/lti4-platform-mssql.sql b/sql/lti4-platform-mssql.sql index 7ae68fe..ad2cc52 100644 --- a/sql/lti4-platform-mssql.sql +++ b/sql/lti4-platform-mssql.sql @@ -17,5 +17,5 @@ CREATE TABLE lti2_tool ( created datetime2 NOT NULL, updated datetime2 NOT NULL, PRIMARY KEY (tool_pk), - CONSTRAINT UC_lti2_tool_initiate_login_url UNIQUE (initiate_login_url ASC) + INDEX UC_lti2_tool_initiate_login_url UNIQUE (initiate_login_url) WHERE (initiate_login_url IS NOT NULL) ); diff --git a/sql/lti4-tables-mssql.sql b/sql/lti4-tables-mssql.sql index dd7731e..3c7cff4 100644 --- a/sql/lti4-tables-mssql.sql +++ b/sql/lti4-tables-mssql.sql @@ -23,8 +23,8 @@ CREATE TABLE lti2_consumer ( created datetime2 NOT NULL, updated datetime2 NOT NULL, PRIMARY KEY (consumer_pk), - CONSTRAINT UC_lti2_consumer_consumer_key UNIQUE (consumer_key), - CONSTRAINT UC_lti2_consumer_platform UNIQUE (platform_id, client_id, deployment_id) + INDEX UC_lti2_consumer_consumer_key UNIQUE (consumer_key) WHERE (consumer_key IS NOT NULL), + INDEX UC_lti2_consumer_platform UNIQUE (platform_id, client_id, deployment_id) WHERE (platform_id IS NOT NULL) AND (client_id IS NOT NULL) AND (deployment_id IS NOT NULL) ); CREATE TABLE lti2_nonce (