2018-04-30 11:52:15 +02:00
|
|
|
ALTER TABLE ciphers RENAME TO oldCiphers;
|
|
|
|
|
|
|
|
CREATE TABLE ciphers (
|
2019-05-20 21:12:41 +02:00
|
|
|
uuid VARCHAR(40) NOT NULL PRIMARY KEY,
|
2018-04-30 11:52:15 +02:00
|
|
|
created_at DATETIME NOT NULL,
|
|
|
|
updated_at DATETIME NOT NULL,
|
2019-05-20 21:12:41 +02:00
|
|
|
user_uuid VARCHAR(40) REFERENCES users (uuid), -- Make this optional
|
|
|
|
organization_uuid VARCHAR(40) REFERENCES organizations (uuid), -- Add reference to orgs table
|
2018-04-30 11:52:15 +02:00
|
|
|
-- Remove folder_uuid
|
2019-05-20 21:12:41 +02:00
|
|
|
atype INTEGER NOT NULL,
|
2018-04-30 11:52:15 +02:00
|
|
|
name TEXT NOT NULL,
|
|
|
|
notes TEXT,
|
|
|
|
fields TEXT,
|
|
|
|
data TEXT NOT NULL,
|
|
|
|
favorite BOOLEAN NOT NULL
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE folders_ciphers (
|
2019-05-20 21:12:41 +02:00
|
|
|
cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
|
|
|
|
folder_uuid VARCHAR(40) NOT NULL REFERENCES folders (uuid),
|
2018-04-30 11:52:15 +02:00
|
|
|
|
|
|
|
PRIMARY KEY (cipher_uuid, folder_uuid)
|
|
|
|
);
|
|
|
|
|
2019-05-20 21:12:41 +02:00
|
|
|
INSERT INTO ciphers (uuid, created_at, updated_at, user_uuid, organization_uuid, atype, name, notes, fields, data, favorite)
|
|
|
|
SELECT uuid, created_at, updated_at, user_uuid, organization_uuid, atype, name, notes, fields, data, favorite FROM oldCiphers;
|
2018-04-30 11:52:15 +02:00
|
|
|
|
|
|
|
INSERT INTO folders_ciphers (cipher_uuid, folder_uuid)
|
|
|
|
SELECT uuid, folder_uuid FROM oldCiphers WHERE folder_uuid IS NOT NULL;
|
|
|
|
|
|
|
|
|
2018-05-04 20:10:35 +02:00
|
|
|
DROP TABLE oldCiphers;
|
|
|
|
|
|
|
|
ALTER TABLE users_collections ADD COLUMN read_only BOOLEAN NOT NULL DEFAULT 0; -- False
|