From 0a8fcef3f20e0b3452f6a6bbb352052e8df2633e Mon Sep 17 00:00:00 2001 From: yuetsh <517252939@qq.com> Date: Thu, 6 Aug 2026 21:14:23 -0600 Subject: [PATCH] =?UTF-8?q?chore(=E9=98=B6=E6=AE=B51):=20=E9=A2=98?= =?UTF-8?q?=E7=9B=AE=E6=A0=B7=E6=9C=AC=E5=AF=BC=E5=85=A5=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=EF=BC=88=E4=B8=8D=E5=90=AB=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ docs/specs/sample-data.sql | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 docs/specs/sample-data.sql diff --git a/.gitignore b/.gitignore index 0ee9d6f..274dc5b 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ build/ # 否则 spike 换台机器就跑不起来(曾漏掉三个 tree-sitter 依赖,ast-spike.ts 直接报错) docs/spikes/node_modules/ docs/spikes/endpoints-*.json + +# 生产题目样本只用于本地验收,不进入 git +*.csv diff --git a/docs/specs/sample-data.sql b/docs/specs/sample-data.sql new file mode 100644 index 0000000..1eead29 --- /dev/null +++ b/docs/specs/sample-data.sql @@ -0,0 +1,19 @@ +-- 阶段 1 本地题目样本导入脚本。 +-- +-- /tmp/problems.csv 从生产库 problem 表导出,只取 contest_id IS NULL、按 id +-- 排序的前 20 道题,避免为本地列表验收额外复制比赛数据。 +-- /tmp/tags.csv 从生产库 problem_tag 表导出。两份 CSV 均不包含用户表数据, +-- 仅保留在本机并由 .gitignore 排除;devadmin 只是满足外键的本地占位用户。 + +\set ON_ERROR_STOP on + +BEGIN; + +INSERT INTO "user" (id, password, username, admin_type, problem_permission, open_api, is_disabled, session_keys, raw_password) +VALUES (1, 'unusable', 'devadmin', 'Super Admin', 'All', false, false, '[]'::jsonb, 'devonly') +ON CONFLICT (id) DO NOTHING; + +\copy problem_tag FROM '/tmp/tags.csv' WITH CSV HEADER +\copy problem FROM '/tmp/problems.csv' WITH CSV HEADER + +COMMIT;