Skip to content

Commit

Permalink
Add migration/upgrade e2e user to platform admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Shumway committed Feb 5, 2025
1 parent 10b0ce7 commit 4512169
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions migrations/versions/0415_change_admin_e2e_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import datetime
import os
import uuid

import sqlalchemy as sa
from alembic import op

from app import db
from app.dao.users_dao import get_user_by_email
from app.models import User
from app.utils import utc_now

revision = "0415_change_admin_e2e_user"
down_revision = "0414_change_total_message_limit"


def upgrade():
email_address = os.getenv("NOTIFY_E2E_TEST_EMAIL")
conn = op.get_bind()
update_sql = """
UPDATE users SET platform_admin = 't' WHERE email_address = :email_address
"""
conn.execute(sa.text(update_sql), {"email_address": email_address})


def downgrade():
email_address = os.getenv("NOTIFY_E2E_TEST_EMAIL")
conn = op.get_bind()
update_sql = """
UPDATE users SET platform_admin = 'f' WHERE email_address = :email_address
"""
conn.execute(sa.text(update_sql), {"email_address": email_address})

0 comments on commit 4512169

Please sign in to comment.