-
Notifications
You must be signed in to change notification settings - Fork 6
Database migrations fail on fresh setup: Missing initial table declarations for submissions and tokens #28
Description
The current migration sequence in the [migrations] directory is missing the initial schema creation. When running wrangler d1 migrations apply on a new database instance, the process fails because the first migration attempts to perform an ALTER TABLE operation on the submissions table, which has not yet been created.
Specifically, the migration [20260213_add_submission_token_columns.sql] fails with a SQLITE_ERROR: no such table: submissions.
The base table definitions found in the project's root [schema.sql](such as CREATE TABLE tokens and CREATE TABLE submissions) have not been included as the starting point of the migration history.
api % npx wrangler d1 migrations apply clawpinch
⛅️ wrangler 4.72.0 (update available 4.78.0)
─────────────────────────────────────────────
Resource location: local
Use --remote if you want to access the remote instance.
Migrations to be applied:
┌──────────────────────────────────────────────┐
│ name │
├──────────────────────────────────────────────┤
│ 20260213_add_submission_token_columns.sql │
├──────────────────────────────────────────────┤
│ 20260213_add_raw_post_logs.sql │
├──────────────────────────────────────────────┤
│ 20260216_add_benchmark_versions_hidden.sql │
├──────────────────────────────────────────────┤
│ 20260308_add_github_columns.sql │
├──────────────────────────────────────────────┤
│ 20260308_add_official_flag.sql │
├──────────────────────────────────────────────┤
│ 20260313_normalize_model_names.sql │
├──────────────────────────────────────────────┤
│ 20260329_add_submission_limits_and_flags.sql │
└──────────────────────────────────────────────┘
✔ About to apply 7 migration(s)
Your database may not be available to serve requests during the migration, continue? … yes
🌀 Executing on local database clawpinch (55d5f1f8-cdb6-4b64-a697-ce60a5df2ce1) from .wrangler/state/v3/d1:
🌀 To execute on your remote database, add a --remote flag to your wrangler command.
┌──────────────────────────────────────────────┬────────┐
│ name │ status │
├──────────────────────────────────────────────┼────────┤
│ 20260213_add_submission_token_columns.sql │ ❌ │
├──────────────────────────────────────────────┼────────┤
│ 20260213_add_raw_post_logs.sql │ 🕒️ │
├──────────────────────────────────────────────┼────────┤
│ 20260216_add_benchmark_versions_hidden.sql │ 🕒️ │
├──────────────────────────────────────────────┼────────┤
│ 20260308_add_github_columns.sql │ 🕒️ │
├──────────────────────────────────────────────┼────────┤
│ 20260308_add_official_flag.sql │ 🕒️ │
├──────────────────────────────────────────────┼────────┤
│ 20260313_normalize_model_names.sql │ 🕒️ │
├──────────────────────────────────────────────┼────────┤
│ 20260329_add_submission_limits_and_flags.sql │ 🕒️ │
└──────────────────────────────────────────────┴────────┘
✘ [ERROR] Migration 20260213_add_submission_token_columns.sql failed with the following errors:
✘ [ERROR] no such table: submissions: SQLITE_ERROR
🪵 Logs were written to "/logs/wrangler-2026-03-29_15-40-11_242.log"