Files
3ybactuk-marketplace-go-ser…/comments/db/migrations/00001_create_comments.sql
2025-07-28 23:43:47 +03:00

15 lines
394 B
SQL

-- +goose Up
CREATE TABLE comments (
id BIGINT PRIMARY KEY,
user_id BIGINT NOT NULL,
sku BIGINT NOT NULL,
text VARCHAR(255) NOT NULL,
created_at TIMESTAMP(3) NOT NULL DEFAULT now()
);
CREATE INDEX sku_idx ON comments(sku, created_at DESC, user_id ASC);
CREATE INDEX user_id_idx ON comments(user_id, created_at DESC);
-- +goose Down
DROP TABLE comments;