Files
mtusi2026lab3/migrations/00002_create_chats_table.sql
T
2026-11-05 17:56:30 +03:00

17 lines
469 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE chats (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
title text NOT NULL,
created_at timestamptz NOT NULL DEFAULT now(),
CONSTRAINT chats_title_len CHECK (char_length(title) BETWEEN 1 AND 100
AND btrim(title) <> '')
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS chats;
-- +goose StatementEnd