增加飞飞领取短链
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user