2019-02-13 14:00:52 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
Revision ID: 0260_service_volumes
|
|
|
|
|
Revises: 0259_remove_service_postage
|
|
|
|
|
Create Date: 2019-02-13 13:45:00.782500
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
from alembic import op
|
|
|
|
|
from itertools import product
|
|
|
|
|
import sqlalchemy as sa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
revision = '0260_service_volumes'
|
|
|
|
|
down_revision = '0259_remove_service_postage'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TABLES_AND_CHANNELS = product(
|
|
|
|
|
('services', 'services_history'),
|
|
|
|
|
('volume_{}'.format(channel) for channel in ('email', 'letter', 'sms')),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def upgrade():
|
|
|
|
|
for table, channel in TABLES_AND_CHANNELS:
|
2019-02-14 11:32:50 +00:00
|
|
|
op.add_column(table, sa.Column(channel, sa.Integer(), nullable=True))
|
2019-02-13 14:00:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def downgrade():
|
|
|
|
|
for table, channel in TABLES_AND_CHANNELS:
|
|
|
|
|
op.drop_column(table, channel)
|