2020-08-19 05:16:27 -04:00
|
|
|
CREATE TABLE favorites (
|
|
|
|
user_uuid CHAR(36) NOT NULL REFERENCES users(uuid),
|
|
|
|
cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers(uuid),
|
|
|
|
|
|
|
|
PRIMARY KEY (user_uuid, cipher_uuid)
|
|
|
|
);
|
|
|
|
|
2020-08-22 20:14:05 -04:00
|
|
|
-- Transfer favorite status for user-owned ciphers.
|
|
|
|
INSERT INTO favorites(user_uuid, cipher_uuid)
|
|
|
|
SELECT user_uuid, uuid
|
|
|
|
FROM ciphers
|
|
|
|
WHERE favorite = TRUE
|
|
|
|
AND user_uuid IS NOT NULL;
|
|
|
|
|
2020-08-19 05:16:27 -04:00
|
|
|
ALTER TABLE ciphers
|
|
|
|
DROP COLUMN favorite;
|