19cc7a778c
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`. - Added new API server implementations for objectstory, player, and shop services. - Introduced configuration files for new APIs in `etc/*.yaml`. - Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`. - Removed unused user update handler and user API files. - Added utility functions for context management and HTTP header parsing. - Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
15 lines
532 B
SQL
15 lines
532 B
SQL
CREATE TABLE post_likes
|
|
(
|
|
post_id BIGINT NOT NULL,
|
|
user_id BIGINT NOT NULL,
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
|
|
-- 复合主键,防止重复点赞
|
|
PRIMARY KEY (post_id, user_id)
|
|
);
|
|
|
|
-- [核心索引] 优化 "feed流中判断我是否已赞" (user_id = ? AND post_id IN (...))
|
|
CREATE INDEX idx_post_likes_lookup ON post_likes (user_id, post_id);
|
|
|
|
-- [核心索引] 优化 "我赞过的帖子" 列表
|
|
CREATE INDEX idx_post_likes_user_timeline ON post_likes (user_id, created_at DESC); |