diff --git a/schemas/database/016_remove_recovery.down.sql b/schemas/database/016_remove_recovery.down.sql index 68221433..db41d4f2 100644 --- a/schemas/database/016_remove_recovery.down.sql +++ b/schemas/database/016_remove_recovery.down.sql @@ -5,9 +5,11 @@ CREATE TABLE recoveries ( ALTER TABLE unprocessed_identities ADD COLUMN eligibility TIMESTAMPTZ, - ADD COLUMN status VARCHAR(50) NOT NULL, + ADD COLUMN status VARCHAR(50), ADD COLUMN processed_at TIMESTAMPTZ, ADD COLUMN error_message TEXT; +UPDATE unprocessed_identities SET status = 'new', eligibility = CURRENT_TIMESTAMP WHERE status IS NULL; + ALTER TABLE unprocessed_identities - DROP CONSTRAINT unique_commitment; + ALTER COLUMN status SET NOT NULL; diff --git a/schemas/database/016_remove_recovery.up.sql b/schemas/database/016_remove_recovery.up.sql index 4d0ea58a..a82352f4 100644 --- a/schemas/database/016_remove_recovery.up.sql +++ b/schemas/database/016_remove_recovery.up.sql @@ -5,7 +5,3 @@ ALTER TABLE unprocessed_identities DROP COLUMN status, DROP COLUMN processed_at, DROP COLUMN error_message; - -ALTER TABLE unprocessed_identities - ADD CONSTRAINT unique_commitment UNIQUE (commitment); -