2019-04-05 13:18:33 +01:00
|
|
|
"""empty message
|
|
|
|
|
|
|
|
|
|
Revision ID: 0285_default_org_branding
|
|
|
|
|
Revises: 0284_0283_retry
|
|
|
|
|
Create Date: 2016-10-25 17:37:27.660723
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
2023-08-29 14:54:30 -07:00
|
|
|
revision = "0285_default_org_branding"
|
|
|
|
|
down_revision = "0284_0283_retry"
|
2019-04-05 13:18:33 +01:00
|
|
|
|
|
|
|
|
import sqlalchemy as sa
|
2023-12-08 21:43:52 -05:00
|
|
|
from alembic import op
|
2019-04-05 13:18:33 +01:00
|
|
|
|
|
|
|
|
|
2023-07-17 13:16:50 -07:00
|
|
|
def upgrade():
|
2023-08-29 14:54:30 -07:00
|
|
|
op.execute(
|
2023-11-17 09:47:32 -05:00
|
|
|
"""UPDATE organisation SET email_branding_id = email_branding.id
|
2023-07-17 13:16:50 -07:00
|
|
|
FROM email_branding
|
|
|
|
|
WHERE email_branding.domain in (SELECT domain FROM domain WHERE domain.organisation_id = organisation.id)
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
|
|
|
|
)
|
2019-04-05 13:18:33 +01:00
|
|
|
|
2023-08-29 14:54:30 -07:00
|
|
|
op.execute(
|
2023-11-17 09:47:32 -05:00
|
|
|
"""UPDATE organisation SET letter_branding_id = letter_branding.id
|
2023-07-17 13:16:50 -07:00
|
|
|
FROM letter_branding
|
|
|
|
|
WHERE letter_branding.domain in (SELECT domain FROM domain WHERE domain.organisation_id = organisation.id)
|
2023-08-29 14:54:30 -07:00
|
|
|
"""
|
|
|
|
|
)
|
2019-04-05 13:18:33 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2023-07-17 13:16:50 -07:00
|
|
|
op.execute("""UPDATE organisation SET email_branding_id = null""")
|
|
|
|
|
op.execute("""UPDATE organisation SET letter_branding_id = null""")
|