diff --git a/migrations/2018-05-25-232323_update_attachments_reference/down.sql b/migrations/2018-05-25-232323_update_attachments_reference/down.sql new file mode 100644 index 0000000..e69de29 diff --git a/migrations/2018-05-25-232323_update_attachments_reference/up.sql b/migrations/2018-05-25-232323_update_attachments_reference/up.sql new file mode 100644 index 0000000..b7adb77 --- /dev/null +++ b/migrations/2018-05-25-232323_update_attachments_reference/up.sql @@ -0,0 +1,14 @@ +ALTER TABLE attachments RENAME TO oldAttachments; + +CREATE TABLE attachments ( + id TEXT NOT NULL PRIMARY KEY, + cipher_uuid TEXT NOT NULL REFERENCES ciphers (uuid), + file_name TEXT NOT NULL, + file_size INTEGER NOT NULL + +); + +INSERT INTO attachments (id, cipher_uuid, file_name, file_size) +SELECT id, cipher_uuid, file_name, file_size FROM oldAttachments; + +DROP TABLE oldAttachments; \ No newline at end of file