-- +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;