Files
evening_detective_server/migrations/20260712154823_create_scenarios_table.sql
T
2026-07-13 23:48:20 +07:00

20 lines
650 B
SQL

-- +goose Up
CREATE TABLE
IF NOT EXISTS scenarios (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL UNIQUE,
description TEXT,
image TEXT,
scenario JSONB NOT NULL DEFAULT '{}'::jsonb,
author_id INTEGER NOT NULL,
status VARCHAR(50) DEFAULT 'draft',
updated_at TIMESTAMP NOT NULL DEFAULT NOW (),
created_at TIMESTAMP NOT NULL DEFAULT NOW (),
published_at TIMESTAMP,
is_deleted BOOLEAN DEFAULT FALSE,
CONSTRAINT fk_scenarios_author FOREIGN KEY (author_id) REFERENCES users (id) ON DELETE RESTRICT
);
-- +goose Down
DROP TABLE IF EXISTS scenarios;