2020-08-19 11:16:27 +02: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-23 02:14:05 +02: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 11:16:27 +02:00
|
|
|
ALTER TABLE ciphers
|
|
|
|
DROP COLUMN favorite;
|