This commit is contained in:
Kenneth Kehl
2023-08-29 14:54:30 -07:00
parent 19dcd7a48b
commit 1ecb747c6d
588 changed files with 34091 additions and 23580 deletions
@@ -6,51 +6,62 @@ Create Date: 2018-08-24 13:36:49.346156
from alembic import op
revision = '0221_nullable_service_branding'
down_revision = '0220_email_brand_type_non_null'
revision = "0221_nullable_service_branding"
down_revision = "0220_email_brand_type_non_null"
def upgrade():
op.drop_constraint("services_branding_fkey", "services", type_="foreignkey")
op.drop_constraint('services_branding_fkey', 'services', type_='foreignkey')
op.drop_index("ix_services_history_branding", table_name="services_history")
op.drop_index("ix_services_branding", table_name="services")
op.drop_index('ix_services_history_branding', table_name='services_history')
op.drop_index('ix_services_branding', table_name='services')
op.alter_column("services_history", "branding", nullable=True)
op.alter_column("services", "branding", nullable=True)
op.alter_column('services_history', 'branding', nullable=True)
op.alter_column('services', 'branding', nullable=True)
op.execute("""
op.execute(
"""
update
email_branding
set
brand_type = 'org'
where
brand_type = 'govuk'
""")
"""
)
op.execute("""
op.execute(
"""
delete from
branding_type
where
name = 'govuk'
""")
"""
)
def downgrade():
op.create_index(
op.f("ix_services_branding"), "services", ["branding"], unique=False
)
op.create_index(
op.f("ix_services_history_branding"),
"services_history",
["branding"],
unique=False,
)
op.create_index(op.f('ix_services_branding'), 'services', ['branding'], unique=False)
op.create_index(op.f('ix_services_history_branding'), 'services_history', ['branding'], unique=False)
op.create_foreign_key(None, "services", "branding_type", ["branding"], ["name"])
op.create_foreign_key(None, 'services', 'branding_type', ['branding'], ['name'])
op.alter_column("services", "branding", nullable=False)
op.alter_column("services_history", "branding", nullable=False)
op.alter_column('services', 'branding', nullable=False)
op.alter_column('services_history', 'branding', nullable=False)
op.execute("""
op.execute(
"""
insert into
branding_type
(name)
values
('govuk')
""")
"""
)