Initial open source release

This commit is contained in:
A 2026-06-04 01:37:39 +08:00
commit 74992e893f
377 changed files with 118084 additions and 0 deletions

View file

@ -0,0 +1,16 @@
CREATE TABLE IF NOT EXISTS user_top_reactions (
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
reaction_type VARCHAR(16) NOT NULL,
reaction_value TEXT NOT NULL,
reaction_count INT NOT NULL DEFAULT 0,
reaction_date INT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (user_id, reaction_type, reaction_value),
CHECK (reaction_type IN ('emoji')),
CHECK (reaction_value <> ''),
CHECK (reaction_count >= 0)
);
CREATE INDEX IF NOT EXISTS user_top_reactions_user_rank_idx
ON user_top_reactions (user_id, reaction_count DESC, reaction_date DESC, updated_at DESC, reaction_value ASC);