diff options
Diffstat (limited to 'migrations')
4 files changed, 17 insertions, 0 deletions
diff --git a/migrations/2020-06-23-134455_create_users/down.sql b/migrations/2020-06-23-134455_create_users/down.sql new file mode 100644 index 0000000..cc1f647 --- /dev/null +++ b/migrations/2020-06-23-134455_create_users/down.sql @@ -0,0 +1 @@ +DROP TABLE users; diff --git a/migrations/2020-06-23-134455_create_users/up.sql b/migrations/2020-06-23-134455_create_users/up.sql new file mode 100644 index 0000000..1f472d2 --- /dev/null +++ b/migrations/2020-06-23-134455_create_users/up.sql @@ -0,0 +1,7 @@ +CREATE TABLE users ( + id SERIAL NOT NULL PRIMARY KEY, + power_level INTEGER NOT NULL DEFAULT 0, + name VARCHAR(32) UNIQUE NOT NULL, + created timestamp NOT NULL DEFAULT current_timestamp(), + hash CHAR(120) BINARY NOT NULL +); diff --git a/migrations/2020-06-23-134458_create_repositories/down.sql b/migrations/2020-06-23-134458_create_repositories/down.sql new file mode 100644 index 0000000..2c8ff6d --- /dev/null +++ b/migrations/2020-06-23-134458_create_repositories/down.sql @@ -0,0 +1 @@ +DROP TABLE repositories; diff --git a/migrations/2020-06-23-134458_create_repositories/up.sql b/migrations/2020-06-23-134458_create_repositories/up.sql new file mode 100644 index 0000000..513d474 --- /dev/null +++ b/migrations/2020-06-23-134458_create_repositories/up.sql @@ -0,0 +1,8 @@ +CREATE TABLE repositories ( + id SERIAL NOT NULL PRIMARY KEY, + name varchar(255) NOT NULL, + description varchar(255) NOT NULL, + owner bigint UNSIGNED NOT NULL, + created timestamp NOT NULL DEFAULT current_timestamp(), + CONSTRAINT fk_owner_id FOREIGN KEY (owner) REFERENCES users (id) +); |
