aboutsummaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
authorNils Domrose <[email protected]>2019-05-27 17:20:20 +0200
committerNils Domrose <[email protected]>2019-05-27 17:20:20 +0200
commit6c38026ef53535bbe88799dd5a85ecd02b95f541 (patch)
tree0d6d2a75b56bc7dd8214c997dda729a81b601c86 /migrations
parent4c9cc9890c9e63840a33233264bd50f8a6d938b2 (diff)
downloadvaultwarden-6c38026ef53535bbe88799dd5a85ecd02b95f541.tar.gz
vaultwarden-6c38026ef53535bbe88799dd5a85ecd02b95f541.zip
user char(36) for uuid columns
Diffstat (limited to 'migrations')
-rw-r--r--migrations/mysql/2018-01-14-171611_create_tables/up.sql22
-rw-r--r--migrations/mysql/2018-02-17-205753_create_collections_and_orgs/up.sql10
-rw-r--r--migrations/mysql/2018-04-27-155151_create_users_ciphers/up.sql10
-rw-r--r--migrations/mysql/2018-05-08-161616_create_collection_cipher_map/up.sql4
-rw-r--r--migrations/mysql/2018-05-25-232323_update_attachments_reference/up.sql4
-rw-r--r--migrations/mysql/2018-07-11-181453_create_u2f_twofactor/up.sql4
6 files changed, 27 insertions, 27 deletions
diff --git a/migrations/mysql/2018-01-14-171611_create_tables/up.sql b/migrations/mysql/2018-01-14-171611_create_tables/up.sql
index 244c3c80..69d161f1 100644
--- a/migrations/mysql/2018-01-14-171611_create_tables/up.sql
+++ b/migrations/mysql/2018-01-14-171611_create_tables/up.sql
@@ -1,5 +1,5 @@
CREATE TABLE users (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
@@ -19,10 +19,10 @@ CREATE TABLE users (
);
CREATE TABLE devices (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
name TEXT NOT NULL,
type INTEGER NOT NULL,
push_token TEXT,
@@ -30,12 +30,12 @@ CREATE TABLE devices (
);
CREATE TABLE ciphers (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
- folder_uuid VARCHAR(40) REFERENCES folders (uuid),
- organization_uuid VARCHAR(40),
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
+ folder_uuid CHAR(36) REFERENCES folders (uuid),
+ organization_uuid CHAR(36),
type INTEGER NOT NULL,
name TEXT NOT NULL,
notes TEXT,
@@ -45,18 +45,18 @@ CREATE TABLE ciphers (
);
CREATE TABLE attachments (
- id VARCHAR(40) NOT NULL PRIMARY KEY,
- cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
+ id CHAR(36) NOT NULL PRIMARY KEY,
+ cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
file_name TEXT NOT NULL,
file_size INTEGER NOT NULL
);
CREATE TABLE folders (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
name TEXT NOT NULL
);
diff --git a/migrations/mysql/2018-02-17-205753_create_collections_and_orgs/up.sql b/migrations/mysql/2018-02-17-205753_create_collections_and_orgs/up.sql
index c5200a76..dd90f9dc 100644
--- a/migrations/mysql/2018-02-17-205753_create_collections_and_orgs/up.sql
+++ b/migrations/mysql/2018-02-17-205753_create_collections_and_orgs/up.sql
@@ -11,15 +11,15 @@ CREATE TABLE organizations (
);
CREATE TABLE users_collections (
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
- collection_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid),
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
+ collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid),
PRIMARY KEY (user_uuid, collection_uuid)
);
CREATE TABLE users_organizations (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
- org_uuid VARCHAR(40) NOT NULL REFERENCES organizations (uuid),
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
+ org_uuid CHAR(36) NOT NULL REFERENCES organizations (uuid),
access_all BOOLEAN NOT NULL,
`key` TEXT NOT NULL,
diff --git a/migrations/mysql/2018-04-27-155151_create_users_ciphers/up.sql b/migrations/mysql/2018-04-27-155151_create_users_ciphers/up.sql
index 65c53d54..573eaf03 100644
--- a/migrations/mysql/2018-04-27-155151_create_users_ciphers/up.sql
+++ b/migrations/mysql/2018-04-27-155151_create_users_ciphers/up.sql
@@ -1,11 +1,11 @@
ALTER TABLE ciphers RENAME TO oldCiphers;
CREATE TABLE ciphers (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
- user_uuid VARCHAR(40) REFERENCES users (uuid), -- Make this optional
- organization_uuid VARCHAR(40) REFERENCES organizations (uuid), -- Add reference to orgs table
+ user_uuid CHAR(36) REFERENCES users (uuid), -- Make this optional
+ organization_uuid CHAR(36) REFERENCES organizations (uuid), -- Add reference to orgs table
-- Remove folder_uuid
type INTEGER NOT NULL,
name TEXT NOT NULL,
@@ -16,8 +16,8 @@ CREATE TABLE ciphers (
);
CREATE TABLE folders_ciphers (
- cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
- folder_uuid VARCHAR(40) NOT NULL REFERENCES folders (uuid),
+ cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
+ folder_uuid CHAR(36) NOT NULL REFERENCES folders (uuid),
PRIMARY KEY (cipher_uuid, folder_uuid)
);
diff --git a/migrations/mysql/2018-05-08-161616_create_collection_cipher_map/up.sql b/migrations/mysql/2018-05-08-161616_create_collection_cipher_map/up.sql
index fe407be1..a2a97406 100644
--- a/migrations/mysql/2018-05-08-161616_create_collection_cipher_map/up.sql
+++ b/migrations/mysql/2018-05-08-161616_create_collection_cipher_map/up.sql
@@ -1,5 +1,5 @@
CREATE TABLE ciphers_collections (
- cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
- collection_uuid VARCHAR(40) NOT NULL REFERENCES collections (uuid),
+ cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
+ collection_uuid CHAR(36) NOT NULL REFERENCES collections (uuid),
PRIMARY KEY (cipher_uuid, collection_uuid)
);
diff --git a/migrations/mysql/2018-05-25-232323_update_attachments_reference/up.sql b/migrations/mysql/2018-05-25-232323_update_attachments_reference/up.sql
index eef50768..50b2c8e2 100644
--- a/migrations/mysql/2018-05-25-232323_update_attachments_reference/up.sql
+++ b/migrations/mysql/2018-05-25-232323_update_attachments_reference/up.sql
@@ -1,8 +1,8 @@
ALTER TABLE attachments RENAME TO oldAttachments;
CREATE TABLE attachments (
- id VARCHAR(40) NOT NULL PRIMARY KEY,
- cipher_uuid VARCHAR(40) NOT NULL REFERENCES ciphers (uuid),
+ id CHAR(36) NOT NULL PRIMARY KEY,
+ cipher_uuid CHAR(36) NOT NULL REFERENCES ciphers (uuid),
file_name TEXT NOT NULL,
file_size INTEGER NOT NULL
diff --git a/migrations/mysql/2018-07-11-181453_create_u2f_twofactor/up.sql b/migrations/mysql/2018-07-11-181453_create_u2f_twofactor/up.sql
index 4fd57175..ab6c753b 100644
--- a/migrations/mysql/2018-07-11-181453_create_u2f_twofactor/up.sql
+++ b/migrations/mysql/2018-07-11-181453_create_u2f_twofactor/up.sql
@@ -1,6 +1,6 @@
CREATE TABLE twofactor (
- uuid VARCHAR(40) NOT NULL PRIMARY KEY,
- user_uuid VARCHAR(40) NOT NULL REFERENCES users (uuid),
+ uuid CHAR(36) NOT NULL PRIMARY KEY,
+ user_uuid CHAR(36) NOT NULL REFERENCES users (uuid),
type INTEGER NOT NULL,
enabled BOOLEAN NOT NULL,
data TEXT NOT NULL,