From 05d70dbee507adf78fd892dac61ed5521a0cf7ee Mon Sep 17 00:00:00 2001 From: Pat Heard Date: Mon, 27 May 2024 15:39:05 +0000 Subject: [PATCH] fix: update migration version --- ...udit_config.py => 0452_set_pgaudit_config.py} | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) rename migrations/versions/{0450_set_pgaudit_config.py => 0452_set_pgaudit_config.py} (76%) diff --git a/migrations/versions/0450_set_pgaudit_config.py b/migrations/versions/0452_set_pgaudit_config.py similarity index 76% rename from migrations/versions/0450_set_pgaudit_config.py rename to migrations/versions/0452_set_pgaudit_config.py index 7d180ea9c7..88f0e87b8e 100644 --- a/migrations/versions/0450_set_pgaudit_config.py +++ b/migrations/versions/0452_set_pgaudit_config.py @@ -1,14 +1,14 @@ """ -Revision ID: 0450_set_pgaudit_config -Revises: 0449_update_magic_link_auth -Create Date: 2024-05-17 12:00:00 +Revision ID: 0452_set_pgaudit_config +Revises: 0451_create_db_users +Create Date: 2024-05-27 12:00:00 """ from alembic import op -revision = "0450_set_pgaudit_config" -down_revision = "0449_update_magic_link_auth" +revision = "0452_set_pgaudit_config" +down_revision = "0451_create_db_users" users = ["app_db_user", "rdsproxyadmin"] database_name = op.get_bind().engine.url.database # database name that the migration is being run on @@ -16,7 +16,7 @@ def upgrade(): # Skip this migration in the test database as there are multiple test databases that are created. - # This leads to a race condition attempting to alter the same users\ multiple times and causes + # This leads to a race condition attempting to alter the same users multiple times and causes # sporadic unit test failures. if "test_notification_api" in database_name: return @@ -30,10 +30,8 @@ def downgrade(): if "test_notification_api" in database_name: return - # Reset the pgaudit.log setting, but do not remove the roles as they are managed - # outside of the API migrations. + # Reset the pgaudit.log setting for user in users: - create_user_if_not_exists(user) op.execute(f"ALTER USER {user} RESET pgaudit.log")