增加飞飞领取短链

This commit is contained in:
yml2213
2026-07-07 21:13:37 +08:00
parent 4131d500f2
commit 58a902dd3b
12 changed files with 527 additions and 14 deletions
@@ -0,0 +1,23 @@
CREATE TABLE IF NOT EXISTS short_links (
id BIGSERIAL PRIMARY KEY,
code TEXT NOT NULL UNIQUE,
target_url TEXT NOT NULL,
target_url_hash TEXT NOT NULL,
source TEXT NOT NULL DEFAULT '',
task_id BIGINT REFERENCES fulfillment_tasks(id) ON DELETE SET NULL,
expires_at TIMESTAMPTZ,
visit_count INTEGER NOT NULL DEFAULT 0,
last_visited_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL,
updated_at TIMESTAMPTZ NOT NULL,
UNIQUE(source, task_id, target_url_hash)
);
CREATE INDEX IF NOT EXISTS idx_short_links_code
ON short_links(code);
CREATE INDEX IF NOT EXISTS idx_short_links_task_id
ON short_links(task_id);
CREATE INDEX IF NOT EXISTS idx_short_links_expires_at
ON short_links(expires_at);