2019-02-13 14:00:52 +00:00
|
|
|
"""
|
|
|
|
|
|
2019-02-15 10:09:44 +00:00
|
|
|
Revision ID: 0261_service_volumes
|
|
|
|
|
Revises: 0260_remove_dvla_organisation
|
2019-02-13 14:00:52 +00:00
|
|
|
Create Date: 2019-02-13 13:45:00.782500
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
from alembic import op
|
|
|
|
|
from itertools import product
|
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
2019-02-15 10:09:44 +00:00
|
|
|
revision = '0261_service_volumes'
|
|
|
|
|
down_revision = '0260_remove_dvla_organisation'
|
2019-02-13 14:00:52 +00:00
|
|
|
|
|
|
|
|
|
2019-02-14 23:57:08 +00:00
|
|
|
TABLES = ['services', 'services_history']
|
|
|
|
|
CHANNELS = ['volume_{}'.format(channel) for channel in ('email', 'letter', 'sms')]
|
2019-02-13 14:00:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
2019-02-14 23:57:08 +00:00
|
|
|
for table in TABLES:
|
|
|
|
|
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))
|
2019-02-13 14:00:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
2019-02-14 23:57:08 +00:00
|
|
|
for table in TABLES:
|
|
|
|
|
op.drop_column(table, 'consent_to_research')
|
|
|
|
|
for channel in CHANNELS:
|
|
|
|
|
op.drop_column(table, channel)
|