17 lines
530 B
SQL
17 lines
530 B
SQL
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)
|
|
);
|