From 84027a38caa25042e5a3ac24464ee9ac3bb7dee6 Mon Sep 17 00:00:00 2001 From: Darshana Gunawardana Date: Thu, 31 Oct 2024 11:21:20 +0530 Subject: [PATCH] Add versioning, created updated times for notification templates schema --- .../resources/dbscripts/db2.sql | 9 +++++++++ .../resources/dbscripts/h2.sql | 9 +++++++++ .../resources/dbscripts/mssql.sql | 9 +++++++++ .../resources/dbscripts/mysql-cluster.sql | 9 +++++++++ .../resources/dbscripts/mysql.sql | 9 +++++++++ .../resources/dbscripts/oracle.sql | 9 +++++++++ .../resources/dbscripts/oracle_rac.sql | 9 +++++++++ .../resources/dbscripts/postgresql.sql | 9 +++++++++ 8 files changed, 72 insertions(+) diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql index c8934674be58..b33683b07ed7 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/db2.sql @@ -2012,6 +2012,9 @@ CREATE TABLE IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -2034,6 +2037,9 @@ CREATE TABLE IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -2058,6 +2064,9 @@ CREATE TABLE IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql index b8bed8110432..0e0f2b263ed2 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/h2.sql @@ -1318,6 +1318,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -1331,6 +1334,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -1346,6 +1352,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql index ae2824ced0bc..3f19a65f3979 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mssql.sql @@ -1463,6 +1463,9 @@ CREATE TABLE IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT DATETIME NOT NULL, + UPDATED_AT DATETIME NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -1477,6 +1480,9 @@ CREATE TABLE IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT DATETIME NOT NULL, + UPDATED_AT DATETIME NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -1493,6 +1499,9 @@ CREATE TABLE IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT DATETIME NOT NULL, + UPDATED_AT DATETIME NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql index d9a4e310daab..f96be70a8a07 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql-cluster.sql @@ -1481,6 +1481,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -1494,6 +1497,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -1509,6 +1515,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql index 60bf37f8ca0f..e50b75883b45 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/mysql.sql @@ -1349,6 +1349,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -1362,6 +1365,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -1377,6 +1383,9 @@ CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql index b1daec5a8412..53dbadc32c62 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle.sql @@ -2069,6 +2069,9 @@ CREATE TABLE IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -2093,6 +2096,9 @@ CREATE TABLE IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -2119,6 +2125,9 @@ CREATE TABLE IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql index 430f4458488f..bb041b427f38 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/oracle_rac.sql @@ -2002,6 +2002,9 @@ CREATE TABLE IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -2026,6 +2029,9 @@ CREATE TABLE IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -2052,6 +2058,9 @@ CREATE TABLE IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql index cfd6cabf6105..c131d9a46155 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/dbscripts/postgresql.sql @@ -1579,6 +1579,9 @@ CREATE TABLE IDN_NOTIFICATION_TYPE ( NAME VARCHAR(255) NOT NULL, CHANNEL VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) @@ -1595,6 +1598,9 @@ CREATE TABLE IDN_NOTIFICATION_ORG_TEMPLATE ( CONTENT_TYPE VARCHAR(50), TYPE_ID INTEGER NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), @@ -1613,6 +1619,9 @@ CREATE TABLE IDN_NOTIFICATION_APP_TEMPLATE ( TYPE_ID INTEGER NOT NULL, APP_ID VARCHAR(255) NOT NULL, TENANT_ID INTEGER NOT NULL, + VERSION VARCHAR(15) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + UPDATED_AT TIMESTAMP NOT NULL, PRIMARY KEY (ID), FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID),