In order to support sending letters by first class we need a way to know how the service wants us to send the letter.

To start with this will be an attribute on the service, at the time the notification is created it will look at Service.letter_class to decide what class to use for the letter.

This PR adds Service.letter class as a nullable column.
Updated the create_service and update_service method to default the value to second.

Subsequent PRs will add the check constraint to ensure we only get first or second in the letter_class column and make that column nullable.
This can't be done all at once because it will cause an error if someone inserts or updates a service during the deploy.
This commit is contained in:
Rebecca Law
2018-09-13 17:06:36 +01:00
parent 39b01f145f
commit 79815b4f8a
5 changed files with 49 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
"""
Revision ID: 0225_letter_class
Revises: 0224_returned_letter_status
Create Date: 2018-09-13 16:23:59.168877
"""
from alembic import op
import sqlalchemy as sa
revision = '0225_letter_class'
down_revision = '0224_returned_letter_status'
def upgrade():
op.add_column('services', sa.Column('letter_class', sa.String(length=255), nullable=True))
op.add_column('services_history', sa.Column('letter_class', sa.String(length=255), nullable=True))
def downgrade():
op.drop_column('services_history', 'letter_class')
op.drop_column('services', 'letter_class')