mirror of
https://github.com/3ybactuk/marketplace-go-service-project.git
synced 2025-10-30 05:53:45 +03:00
16 lines
440 B
SQL
16 lines
440 B
SQL
-- +goose Up
|
|
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 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;
|
|
DROP INDEX sku_idx;
|
|
DROP INDEX user_id_idx; |