diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-01-09 21:20:17 +0100 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-01-09 21:20:17 +0100 |
| commit | 3747204267e8b75bc77d6c0962b67bbe018dad15 (patch) | |
| tree | 4b134c6719b5bab425da8d0840102f27489eb67b /server/migrations | |
| parent | 6c6dd808a1005771f50696e1568dd6c653e2731b (diff) | |
Add string id for project and reduce usage of numeric ids in general
User: username must be unique, use as primary key and drop id.
Diffstat (limited to 'server/migrations')
| -rw-r--r-- | server/migrations/1_initial_eyeballs.sql | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/server/migrations/1_initial_eyeballs.sql b/server/migrations/1_initial_eyeballs.sql index b839c42..6dcd8f1 100644 --- a/server/migrations/1_initial_eyeballs.sql +++ b/server/migrations/1_initial_eyeballs.sql @@ -1,5 +1,5 @@ CREATE TABLE IF NOT EXISTS projects ( - id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, + id VARCHAR(128) NOT NULL PRIMARY KEY, title VARCHAR(1024) NOT NULL, description MEDIUMTEXT NOT NULL DEFAULT '', remote VARCHAR(2048) NOT NULL, @@ -7,15 +7,14 @@ CREATE TABLE IF NOT EXISTS projects ( ); CREATE TABLE IF NOT EXISTS users ( - id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, - username VARCHAR(256) NOT NULL UNIQUE, + id VARCHAR(128) NOT NULL PRIMARY KEY, name VARCHAR(1024) NOT NULL DEFAULT '', dn VARCHAR(256) NULL ); CREATE TABLE IF NOT EXISTS project_users ( - project BIGINT UNSIGNED NOT NULL, - user BIGINT UNSIGNED NOT NULL, + project VARCHAR(128) NOT NULL, + user VARCHAR(128) NOT NULL, default_role TINYINT UNSIGNED NOT NULL, maintainer BOOLEAN NOT NULL DEFAULT 0, PRIMARY KEY (project, user), @@ -33,8 +32,8 @@ CREATE TABLE IF NOT EXISTS project_users ( CREATE TABLE IF NOT EXISTS reviews ( id BIGINT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - project BIGINT UNSIGNED NOT NULL, - owner BIGINT UNSIGNED NOT NULL, + project VARCHAR(128) NOT NULL, + owner VARCHAR(128) NOT NULL, title VARCHAR(1024) NOT NULL, description MEDIUMTEXT NOT NULL DEFAULT '', state TINYINT UNSIGNED NOT NULL DEFAULT 0, @@ -55,7 +54,7 @@ CREATE TABLE IF NOT EXISTS reviews ( CREATE TABLE IF NOT EXISTS review_users ( review BIGINT UNSIGNED NOT NULL, - user BIGINT UNSIGNED NOT NULL, + user VARCHAR(128) NOT NULL, role TINYINT UNSIGNED NOT NULL DEFAULT 0, PRIMARY KEY (review, user), |
