add scenarios methods

This commit is contained in:
2026-07-13 23:48:20 +07:00
parent 487b1aa436
commit db746f2123
17 changed files with 3620 additions and 118 deletions
@@ -0,0 +1,20 @@
-- +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;