Init
This commit is contained in:
commit
e82f35da2a
78 changed files with 10821 additions and 0 deletions
3
backend/migrations/2023-05-02-143642_init/down.sql
Normal file
3
backend/migrations/2023-05-02-143642_init/down.sql
Normal file
|
@ -0,0 +1,3 @@
|
|||
DROP TABLE repositories;
|
||||
|
||||
DROP TABLE users;
|
17
backend/migrations/2023-05-02-143642_init/up.sql
Normal file
17
backend/migrations/2023-05-02-143642_init/up.sql
Normal file
|
@ -0,0 +1,17 @@
|
|||
CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
|
||||
CREATE TABLE users (
|
||||
id uuid PRIMARY KEY DEFAULT GEN_RANDOM_UUID(),
|
||||
name text NOT NULL UNIQUE,
|
||||
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at timestamptz
|
||||
);
|
||||
|
||||
CREATE TABLE repositories (
|
||||
id uuid PRIMARY KEY DEFAULT GEN_RANDOM_UUID(),
|
||||
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
|
||||
name text NOT NULL,
|
||||
created_at timestamptz NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at timestamptz,
|
||||
UNIQUE (user_id, name)
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue