mirror of
https://github.com/tanweai/pua.git
synced 2026-09-01 15:39:55 +08:00
d3219862d9
Summary: - Make the initial uploads index migration use IF NOT EXISTS. - Add a release consistency gate that rejects non-idempotent D1 CREATE INDEX statements. Rationale: - Production D1 already had the old uploads index before Wrangler's migration journal was used, so migrations apply could fail on 0001 before reaching newer migrations. - Keeping migrations idempotent makes future Cloudflare release gates mechanical instead of relying on manual SQL execution. Tests: - bash evals/test-release-consistency.sh - git diff --check Co-authored-by: Codex <codex@openai.com>
13 lines
370 B
SQL
13 lines
370 B
SQL
CREATE TABLE IF NOT EXISTS uploads (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
github_id TEXT NOT NULL,
|
|
github_login TEXT NOT NULL,
|
|
wechat_id TEXT NOT NULL,
|
|
file_key TEXT NOT NULL,
|
|
file_name TEXT NOT NULL,
|
|
file_size INTEGER NOT NULL,
|
|
created_at TEXT NOT NULL DEFAULT (datetime('now'))
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_uploads_github ON uploads(github_id);
|