-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ialt text for email_branding table
- Loading branch information
Showing
2 changed files
with
39 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
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,35 @@ | ||
""" | ||
Revision ID: 0446_add_alt_text.py | ||
Revises: 0445_add_org_id_branding.py | ||
Create Date: 2024-04-23 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy import text | ||
from sqlalchemy.dialects import postgresql | ||
Check notice Code scanning / CodeQL Unused import Note
Import of 'postgresql' is not used.
|
||
|
||
revision = "0446_add_alt_text" | ||
down_revision = "0445_add_org_id_branding" | ||
|
||
|
||
def upgrade(): | ||
table_description = op.get_bind().execute( | ||
text("SELECT * FROM information_schema.columns WHERE table_name = 'email_branding'") | ||
) | ||
|
||
# Check if the column exists | ||
if "alt_text_en" not in [column["column_name"] for column in table_description]: | ||
op.add_column( | ||
"email_branding", | ||
sa.Column("alt_text_en", sa.String(), nullable=True), | ||
) | ||
if "alt_text_fr" not in [column["column_name"] for column in table_description]: | ||
op.add_column( | ||
"email_branding", | ||
sa.Column("alt_text_fr", sa.String(), nullable=True), | ||
) | ||
|
||
|
||
def downgrade(): | ||
op.drop_column("email_branding", "alt_text_fr") | ||
op.drop_column("email_branding", "alt_text_en") |