Skip to content

Commit

Permalink
fix: update migration version
Browse files Browse the repository at this point in the history
  • Loading branch information
patheard committed May 27, 2024
1 parent c693cbd commit 05d70db
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
"""
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


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
Expand All @@ -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")


Expand Down

0 comments on commit 05d70db

Please sign in to comment.