Files
notifications-api/migrations
Katie Smith 186670e10e Update postage db constraints for international letters
The `notifications`, `notification_history`, `templates` and `templates_history`
tables all had a check constraint on the postage column which specified
that the postage had to be `first` or `second` if the notification or
template was a letter. We now have two more options for postage -
`europe` and `rest-of-world`.

It's not possible to alter a check constraint, so the constraints have
to be dropped then recreated. We are not recreating the constraint on
the `notification_history` table since values here are always copied
from the `notifications` table.

The constraints get added as `NOT VALID` at first - this stage will lock
the tables, so updating the `notification` table and `templates` and
`templates_history` are done in separate migrations so that we don't lock
all tables at the same time. In a third migration we then run
`VALIDATE CONSTRAINT` for all tables - this will lock a row at a time,
not the whole table.
2020-04-07 08:01:11 +01:00
..

Generic single-database configuration.

flask db migrate to generate migration script.

flask db upgrade to upgrade db with script.

flask db downgrade to rollback db changes.

flask db current to show current script.