From 1043c3fee6c8cf3c58300f6b3af8f5f4cccff6fb Mon Sep 17 00:00:00 2001 From: TheoLechemia Date: Fri, 12 Jul 2024 14:44:43 +0200 Subject: [PATCH] add missing grp_site object to monitoring module --- ...6_add_site_group_object_for_monitoring_.py | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 backend/gn_module_monitoring/migrations/be30fb5c1a56_add_site_group_object_for_monitoring_.py diff --git a/backend/gn_module_monitoring/migrations/be30fb5c1a56_add_site_group_object_for_monitoring_.py b/backend/gn_module_monitoring/migrations/be30fb5c1a56_add_site_group_object_for_monitoring_.py new file mode 100644 index 000000000..e7230d72a --- /dev/null +++ b/backend/gn_module_monitoring/migrations/be30fb5c1a56_add_site_group_object_for_monitoring_.py @@ -0,0 +1,37 @@ +"""add site group object for monitoring module + +Revision ID: be30fb5c1a56 +Revises: 34253c8fa9b9 +Create Date: 2024-07-12 14:42:28.611638 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'be30fb5c1a56' +down_revision = '34253c8fa9b9' +branch_labels = None +depends_on = None + + +def upgrade(): + op.execute( + """ + INSERT INTO gn_permissions.cor_object_module (id_object ,id_module) + VALUES + ((select id_object from gn_permissions.t_objects where code_object = 'MONITORINGS_GRP_SITES'), + (select id_module from gn_commons.t_modules where module_code = 'MONITORINGS')); + """ + ) + + +def downgrade(): + op.execute( + """ + DELETE FROM gn_permissions.cor_object_module + WHERE id_object = (select id_object from gn_permissions.t_objects where code_object = 'MONITORINGS_GRP_SITES') + AND id_module = (select id_module from gn_commons.t_modules where module_code = 'MONITORINGS'); + """ + )