diff --git a/CHANGELOG.md b/CHANGELOG.md index 19b1d0595..ebab7f70c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - [#165](https://github.com/LayerManager/layman/issues/165) Add column `role_name` to table `rights` in prime DB schema. Add constraint that exactly one of columns `role_name` and `id_user` is not null. - [#165](https://github.com/LayerManager/layman/issues/165) Create DB schema `_role_service` that can be used as [role service](doc/security.md#role-service). - [#165](https://github.com/LayerManager/layman/issues/165) Column `name` in table `workspace` in prime DB schema length is changed to 59 characters. +- Drop DB table `right_types`. #### Data migrations - [#165](https://github.com/LayerManager/layman/issues/165) Delete technical roles and user-role relations in GeoServer `default` role service, which is now replaced by JDBC role service. ### Changes diff --git a/src/layman/upgrade/__init__.py b/src/layman/upgrade/__init__.py index 3ec62d887..623d68eeb 100644 --- a/src/layman/upgrade/__init__.py +++ b/src/layman/upgrade/__init__.py @@ -45,6 +45,7 @@ upgrade_v1_23.adjust_db_for_roles, upgrade_v1_23.restrict_workspace_name_length, upgrade_v1_23.create_role_service_schema, + upgrade_v1_23.remove_right_types_table, ]), ], consts.MIGRATION_TYPE_DATA: [ diff --git a/src/layman/upgrade/upgrade_v1_23.py b/src/layman/upgrade/upgrade_v1_23.py index f4c06b0e5..7078138e0 100644 --- a/src/layman/upgrade/upgrade_v1_23.py +++ b/src/layman/upgrade/upgrade_v1_23.py @@ -187,3 +187,16 @@ def restrict_workspace_name_length(): ALTER COLUMN name TYPE VARCHAR(59) COLLATE pg_catalog."default" ;""" db_util.run_statement(alter_column) + + +def remove_right_types_table(): + logger.info(f' Remove right_types table') + + remove_fk_statement = f"""alter table {settings.LAYMAN_PRIME_SCHEMA}.rights drop constraint rights_type_fkey;""" + db_util.run_statement(remove_fk_statement) + + create_check_statement = f"""alter table {settings.LAYMAN_PRIME_SCHEMA}.rights add constraint rights_type check (type in ('read', 'write'));""" + db_util.run_statement(create_check_statement) + + drop_table_statement = f"""drop table {settings.LAYMAN_PRIME_SCHEMA}.right_types""" + db_util.run_statement(drop_table_statement)