Also store consent to research against a service

It makes most sense to collect this at the same time as the estimated
volumes. Which means we need to store it somewhere; we can’t put it
straight into the ticket.
This commit is contained in:
Chris Hill-Scott
2019-02-14 23:57:08 +00:00
parent ecdf076506
commit f679731af8
3 changed files with 35 additions and 8 deletions

View File

@@ -14,17 +14,19 @@ 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')),
)
TABLES = ['services', 'services_history']
CHANNELS = ['volume_{}'.format(channel) for channel in ('email', 'letter', 'sms')]
def upgrade():
for table, channel in TABLES_AND_CHANNELS:
op.add_column(table, sa.Column(channel, sa.Integer(), nullable=True))
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))
def downgrade():
for table, channel in TABLES_AND_CHANNELS:
op.drop_column(table, channel)
for table in TABLES:
op.drop_column(table, 'consent_to_research')
for channel in CHANNELS:
op.drop_column(table, channel)