Skip to content

Migration 016_api_tokens fails with "table already exists" on fresh D1 database #954

@merrickma

Description

@merrickma

Description

Environment

  • EmDash version: 0.10.x (latest)
  • Deployment: Cloudflare Workers + D1

Steps to reproduce

  1. Create a new EmDash project with npm create emdash@latest
  2. Deploy to Cloudflare Workers with a fresh D1 database
  3. Visit /_emdash/admin/setup

Error
Migration failed: D1_ERROR: table "_emdash_api_tokens" already exists
at offset 13 (migration: 016_api_tokens)

Expected
Setup wizard should initialize successfully on a fresh D1 database.

Notes
The table exists but the migration record is missing from _emdash_migrations,
causing the migration to re-run and fail on every request.

Steps to reproduce

  1. Create a new EmDash project with npm create emdash@latest
  2. Select Cloudflare Workers as deployment target
  3. Run npm install emdash@latest to fix version conflict from scaffold
  4. Run npm run build && wrangler deploy with a fresh D1 database
  5. Visit /_emdash/admin/setup

Environment

  1. Create a new EmDash project with npm create emdash@latest
  2. Select Cloudflare Workers as deployment target
  3. Run npm install emdash@latest to fix version conflict from scaffold
  4. Run npm run build && wrangler deploy with a fresh D1 database
  5. Visit /_emdash/admin/setup

Logs / error output

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions