-
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.
Add org_id to Email Branding Table (#2128)
* Add organisation_id to email_branding * fix format * fix * test updates * fixes
- Loading branch information
Showing
4 changed files
with
69 additions
and
5 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
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,46 @@ | ||
""" | ||
Revision ID: 0445_add_org_id_branding | ||
Revises: 0444_add_index_n_history2.py | ||
Create Date: 2024-02-27 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
revision = "0445_add_org_id_branding" | ||
down_revision = "0444_add_index_n_history2" | ||
|
||
|
||
def upgrade(): | ||
op.add_column( | ||
"email_branding", | ||
sa.Column("organisation_id", postgresql.UUID(as_uuid=True), nullable=True), | ||
) | ||
op.create_index( | ||
op.f("ix_email_branding_organisation_id"), | ||
"email_branding", | ||
["organisation_id"], | ||
unique=False, | ||
) | ||
op.create_foreign_key( | ||
"fk_email_branding_organisation", | ||
"email_branding", | ||
"organisation", | ||
["organisation_id"], | ||
["id"], | ||
ondelete="SET NULL", | ||
) | ||
op.drop_constraint("fk_organisation_email_branding_id", "organisation", type_="foreignkey") | ||
|
||
|
||
def downgrade(): | ||
op.drop_index(op.f("ix_email_branding_organisation_id"), table_name="email_branding") | ||
op.drop_constraint("fk_email_branding_organisation", "email_branding", type_="foreignkey") | ||
op.drop_column("email_branding", "organisation_id") | ||
op.create_foreign_key( | ||
"fk_organisation_email_branding_id", | ||
"organisation", | ||
"email_branding", | ||
["email_branding_id"], | ||
["id"], | ||
) |
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