From de51625894b7dbbb9f1395db49cc1a17b8f995bc Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Mon, 29 Jun 2020 09:20:11 -0400 Subject: [PATCH] Finally removing Roles / UserRole tables We have been running for some time without actually utilizing these tables and as such it should be safe to remove them. These changes will make sure that the tables are not created / referenced in ETL actions as well as making sure that they are removed in existing installations when an upgrade is performed. --- configuration/etl/etl.d/xdb.json | 13 ------- .../etl.d/xdmod-migration-8_5_1-9_0_0.json | 18 ++++++++++ .../etl/etl_action_defs.d/xdb/roles.json | 8 ----- configuration/etl/etl_data.d/xdb/roles.json | 9 ----- .../8.5.1-9.0.0/role-table-cleanup.sql | 4 +++ configuration/etl/etl_tables.d/xdb/roles.json | 35 ------------------- 6 files changed, 22 insertions(+), 65 deletions(-) delete mode 100644 configuration/etl/etl_action_defs.d/xdb/roles.json delete mode 100644 configuration/etl/etl_data.d/xdb/roles.json create mode 100644 configuration/etl/etl_sql.d/migrations/8.5.1-9.0.0/role-table-cleanup.sql delete mode 100644 configuration/etl/etl_tables.d/xdb/roles.json diff --git a/configuration/etl/etl.d/xdb.json b/configuration/etl/etl.d/xdb.json index b57925e8cb..0c1e497c42 100644 --- a/configuration/etl/etl.d/xdb.json +++ b/configuration/etl/etl.d/xdb.json @@ -45,7 +45,6 @@ "xdb/report-templates.json", "xdb/reports.json", "xdb/restx509.json", - "xdb/roles.json", "xdb/schema-version-history.json", "xdb/session-manager.json", "xdb/users.json", @@ -91,18 +90,6 @@ } } }, - { - "name": "roles", - "definition_file": "xdb/roles.json", - "description": "roles + data", - "endpoints": { - "source": { - "type": "jsonfile", - "name": "roles", - "path": "xdb/roles.json" - } - } - }, { "name": "schema-version", "definition_file": "xdb/schema-version-history.json", diff --git a/configuration/etl/etl.d/xdmod-migration-8_5_1-9_0_0.json b/configuration/etl/etl.d/xdmod-migration-8_5_1-9_0_0.json index 933fe2f5cd..0023dff964 100644 --- a/configuration/etl/etl.d/xdmod-migration-8_5_1-9_0_0.json +++ b/configuration/etl/etl.d/xdmod-migration-8_5_1-9_0_0.json @@ -459,6 +459,24 @@ "schema": "modw" } } + }, + { + "name": "remove-role-tables", + "description": "Remove the Role related tables as they are no longer used.", + "namespace": "ETL\\Maintenance", + "class": "ExecuteSql", + "options_class": "MaintenanceOptions", + "sql_file_list": [ + "migrations/8.5.1-9.0.0/role-table-cleanup.sql" + ], + "endpoints": { + "destination": { + "type": "mysql", + "name": "Logger Database", + "config": "database", + "schema": "moddb" + } + } } ] } diff --git a/configuration/etl/etl_action_defs.d/xdb/roles.json b/configuration/etl/etl_action_defs.d/xdb/roles.json deleted file mode 100644 index 723c73ac69..0000000000 --- a/configuration/etl/etl_action_defs.d/xdb/roles.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "#": "This action loads data from a structured file and only needs the table definition", - "table_definition": [ - { - "$ref": "${table_definition_dir}/xdb/roles.json#/table_definition" - } - ] -} diff --git a/configuration/etl/etl_data.d/xdb/roles.json b/configuration/etl/etl_data.d/xdb/roles.json deleted file mode 100644 index 343dbe701e..0000000000 --- a/configuration/etl/etl_data.d/xdb/roles.json +++ /dev/null @@ -1,9 +0,0 @@ -[ - ["role_id", "abbrev", "description"], - [0, "mgr", "Manager"], - [1, "cd", "Center Director"], - [3, "usr", "User"], - [4, "pi", "Principal Investigator"], - [5, "cs", "Center Staff"], - [7, "dev", "Developer"] -] diff --git a/configuration/etl/etl_sql.d/migrations/8.5.1-9.0.0/role-table-cleanup.sql b/configuration/etl/etl_sql.d/migrations/8.5.1-9.0.0/role-table-cleanup.sql new file mode 100644 index 0000000000..63ae82991f --- /dev/null +++ b/configuration/etl/etl_sql.d/migrations/8.5.1-9.0.0/role-table-cleanup.sql @@ -0,0 +1,4 @@ +-- These tables are no longer user and as such are being removed. +DROP TABLE IF EXISTS moddb.UserRoleParameters; +DROP TABLE IF EXISTS moddb.UserRoles; +DROP TABLE IF EXISTS moddb.Roles; diff --git a/configuration/etl/etl_tables.d/xdb/roles.json b/configuration/etl/etl_tables.d/xdb/roles.json deleted file mode 100644 index 430929c7c8..0000000000 --- a/configuration/etl/etl_tables.d/xdb/roles.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "table_definition": { - "name": "Roles", - "engine": "InnoDB", - "columns": [ - { - "name": "role_id", - "type": "int(4)", - "nullable": false, - "default": 0 - }, - { - "name": "abbrev", - "type": "varchar(20)", - "nullable": false - }, - { - "name": "description", - "type": "varchar(30)", - "nullable": true - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "role_id" - ], - "type": "BTREE", - "is_unique": true - } - ], - "triggers": [] - } -}