Files
mtusi2026lab3/service/migrations/003_create_chats_table.sql
T

15 lines
378 B
SQL

CREATE TABLE IF NOT EXISTS chats
(
id UUID PRIMARY KEY,
title VARCHAR(100) NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
CONSTRAINT chats_title_not_blank CHECK (title !~ '^[[:space:]]*$')
);
CREATE INDEX IF NOT EXISTS idx_chats_created_at_id ON chats (created_at, id);
---- create above / drop below ----
DROP TABLE IF EXISTS chats;