gitea_pages/backend/migrations/2023-05-02-143642_init/up.sql

18 lines
530 B
MySQL
Raw Normal View History

2023-05-21 16:58:10 +00:00
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)
);