Files
evening_detective_server/migrations/20260725141619_crerate_teams_table.sql
T
2026-08-03 00:49:27 +07:00

18 lines
565 B
SQL

-- +goose Up
CREATE TABLE
IF NOT EXISTS teams (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
status VARCHAR(50) DEFAULT 'register',
creator_id INTEGER NOT NULL,
game_id INTEGER NOT NULL,
password TEXT,
created_at TIMESTAMP NOT NULL DEFAULT NOW (),
CONSTRAINT fk_teams_game FOREIGN KEY (game_id) REFERENCES games (id) ON DELETE RESTRICT,
CONSTRAINT fk_teams_creator FOREIGN KEY (creator_id) REFERENCES users (id) ON DELETE RESTRICT
);
-- +goose Down
DROP TABLE IF EXISTS teams;