-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add migration/upgrade e2e user to platform admin
- Loading branch information
Andrew Shumway
committed
Feb 5, 2025
1 parent
10b0ce7
commit 4512169
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) |