Files
pua/landing/migrations/0001_init.sql
T
xsser d3219862d9 fix(landing): make d1 migrations idempotent
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>
2026-05-09 17:04:56 +08:00

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);