Files
notifications-api/migrations/versions/0261_service_volumes.py

42 lines
952 B
Python
Raw Normal View History

"""
2019-02-15 10:09:44 +00:00
Revision ID: 0261_service_volumes
Revises: 0260_remove_dvla_organisation
Create Date: 2019-02-13 13:45:00.782500
"""
2024-04-01 15:12:33 -07:00
from itertools import product
import sqlalchemy as sa
from alembic import op
2023-08-29 14:54:30 -07:00
revision = "0261_service_volumes"
down_revision = "0260_remove_dvla_organisation"
2023-08-29 14:54:30 -07:00
TABLES = ["services", "services_history"]
CHANNELS = ["volume_email", "volume_letter", "volume_sms"]
def upgrade():
for table in TABLES:
2023-08-29 14:54:30 -07:00
op.add_column(
table,
sa.Column(
"consent_to_research",
sa.Boolean(),
nullable=False,
server_default=sa.false(),
),
)
for channel in CHANNELS:
op.add_column(table, sa.Column(channel, sa.Integer(), nullable=True))
def downgrade():
for table in TABLES:
2023-08-29 14:54:30 -07:00
op.drop_column(table, "consent_to_research")
for channel in CHANNELS:
op.drop_column(table, channel)