Make SMS prefix setting non-nullable

We have now:
- defaulted new services to start with this column set to `true`
- migrated all preexisting services[1] to have either `true` or `false` set
  for this column

There is no way for a service to switch back from `true`/`false` to
`null`.

This means that we can safely enforce a non-nullable constraint on this
column now.

1. There is a little gotcha: the GOV.UK Notify service still relies on
   the `sms_sender` column. It doesn’t have a row in the
   `service_sms_senders` table. This means the previous migration
   never changed this service’s value for `prefix_sms` from `null`. So
   this commit also changes its value to `False`, so that the rest of
   the migration, of the whole column, is possible.
This commit is contained in:
Chris Hill-Scott
2017-11-03 16:44:33 +00:00
parent bf5e6db666
commit e8a94422e5
4 changed files with 60 additions and 3 deletions

View File

@@ -992,7 +992,7 @@ def notify_service(notify_db, notify_db_session):
'active': True,
'restricted': False,
'email_from': 'notify.service',
'created_by': user
'created_by': user,
}
service = Service(**data)
db.session.add(service)