-- Your SQL goes here
CREATE TABLE users (
    id BIGINT PRIMARY KEY
);

CREATE TYPE ticket_status AS ENUM ('open', 'closed', 'deleted');

CREATE TABLE tickets (
    id BIGSERIAL PRIMARY KEY,
    user_id BIGINT REFERENCES users(id) NOT NULL,
    channel_id BIGINT,

    starting_message TEXT NOT NULL,
    category TEXT NOT NULL,
    vip BOOLEAN DEFAULT FALSE NOT NULL,
    status ticket_status DEFAULT 'open' NOT NULL,
    closed_by BIGINT REFERENCES users(id),

    created_at TIMESTAMPTZ DEFAULT NOW() NOT NULL,
    updated_at TIMESTAMPTZ DEFAULT NOW() NOT NULL,
    closed_at TIMESTAMPTZ,
    deleted_at TIMESTAMPTZ
);

SELECT diesel_manage_updated_at('tickets');