mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 05:53:45 +03:00
11 lines
327 B
SQL
11 lines
327 B
SQL
CREATE TABLE comments (
|
|
id BIGSERIAL 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 ON comments(sku, created_at DESC, user_id ASC);
|
|
CREATE INDEX ON comments(user_id, created_at DESC);
|