ente/server/migrations/8_update_otts_schema_link_with_email.down.sql
2024-03-01 13:37:01 +05:30

11 lines
255 B
SQL

ALTER TABLE otts
ADD COLUMN user_id INTEGER;
UPDATE otts
SET user_id = (SELECT user_id
FROM users
WHERE users.email=otts.email);
ALTER TABLE otts
DROP COLUMN email,
ALTER COLUMN user_id SET NOT NULL;