placidticket/migrations/2025-02-20-065910_add_tickets/up.sql
azyrite a517812c48
chore: init
Rewrite placidticket code
2025-02-21 22:52:20 +11:00

25 lines
No EOL
667 B
SQL

-- 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');