[hw-8] add: comment service

This commit is contained in:
3ybacTuK
2025-07-26 23:47:18 +03:00
parent 6420eaf3d7
commit 6e0d90a6d5
29 changed files with 1249 additions and 725 deletions

View File

@@ -1,3 +1,4 @@
-- +goose Up
CREATE TABLE comments (
id BIGSERIAL PRIMARY KEY,
user_id BIGINT NOT NULL,
@@ -6,5 +7,10 @@ CREATE TABLE comments (
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);
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;