mirror of
https://github.com/LukeMathWalker/zero-to-production.git
synced 2024-11-22 00:31:01 +00:00
Make status mandatory.
This commit is contained in:
parent
d2fd3fe1fa
commit
70334b9fc4
1 changed files with 11 additions and 0 deletions
|
@ -0,0 +1,11 @@
|
|||
-- We wrap the whole migration in a transaction to make sure
|
||||
-- it succeeds or fails atomically.
|
||||
-- `sqlx` does not do it automatically for us.
|
||||
BEGIN;
|
||||
-- Backfill `status` for historical entries
|
||||
UPDATE subscriptions
|
||||
SET status = 'confirmed'
|
||||
WHERE status IS NULL;
|
||||
-- Make `status` mandatory
|
||||
ALTER TABLE subscriptions ALTER COLUMN status SET NOT NULL;
|
||||
COMMIT;
|
Loading…
Reference in a new issue