fuck_microsoft_access/migrations/2026-01-13-095855-0000_tickets/up.sql

12 lines
470 B
SQL

CREATE TABLE IF NOT EXISTS tickets (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
title TEXT NOT NULL,
description TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
service_id BIGINT NOT NULL,
created_by_user_id BIGINT NOT NULL,
CONSTRAINT fk_service_id FOREIGN KEY (service_id) REFERENCES assigned_services(id) ON DELETE CASCADE,
CONSTRAINT fk_user_id FOREIGN KEY (created_by_user_id) REFERENCES users(id) ON DELETE CASCADE
)