D1 Failing Migraton on Prod

import type { Config } from 'drizzle-kit';

export default {
schema: 'src/lib/db/schema.ts',
out: 'migrations',
dialect: 'sqlite',
dbCredentials: {
wranglerConfigPath: 'wrangler.toml',
url: '.wrangler/state/v3/d1/miniflare-D1DatabaseObject/34ef4850cc5e4f26e767cd5ae08b398d6f9e9215b83406a22b3e5e1ba038b491.sqlite',
dbName: 'vertex',
bindingName: 'DB'
}
} satisfies Config;
import type { Config } from 'drizzle-kit';

export default {
schema: 'src/lib/db/schema.ts',
out: 'migrations',
dialect: 'sqlite',
dbCredentials: {
wranglerConfigPath: 'wrangler.toml',
url: '.wrangler/state/v3/d1/miniflare-D1DatabaseObject/34ef4850cc5e4f26e767cd5ae08b398d6f9e9215b83406a22b3e5e1ba038b491.sqlite',
dbName: 'vertex',
bindingName: 'DB'
}
} satisfies Config;
➜ vertex git:(main) ✗ bun run d1:gen
$ drizzle-kit generate --config=drizzle.config.ts
drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Reading config file '/Users/alexg/Desktop/vertex/drizzle.config.ts'
1 tables
products 3 columns 0 indexes 0 fks

[✓] Your SQL migration file ➜ migrations/0000_soft_stellaris.sql :rocket:
➜ vertex git:(main) ✗ bun run d1:mig:local
$ wrangler d1 migrations apply vertex --local

⛅️ wrangler 3.60.2
-------------------

Migrations to be applied:
┌─────────────────────────┐
│ name │
├─────────────────────────┤
│ 0000_soft_stellaris.sql │
└─────────────────────────┘
✔ About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue? … yes
:cyclone: Executing on local database vertex (23e8bef3-b7e0-4e9e-94ef-447a3b77361b) from .wrangler/state/v3/d1:
:cyclone: To execute on your remote database, add a --remote flag to your wrangler command.
┌─────────────────────────┬────────┐
│ name │ status │
├─────────────────────────┼────────┤
│ 0000_soft_stellaris.sql │ :white_check_mark: │
└─────────────────────────┴────────┘
➜ vertex git:(main) ✗ bun run d1:mig:prod
$ wrangler d1 migrations apply vertex

⛅️ wrangler 3.60.2
-------------------

:white_check_mark: No migrations to apply!
➜ vertex git:(main) ✗ bun run d1:gen
$ drizzle-kit generate --config=drizzle.config.ts
drizzle-kit: v0.22.7
drizzle-orm: v0.31.2

Reading config file '/Users/alexg/Desktop/vertex/drizzle.config.ts'
1 tables
products 3 columns 0 indexes 0 fks

[✓] Your SQL migration file ➜ migrations/0000_soft_stellaris.sql :rocket:
➜ vertex git:(main) ✗ bun run d1:mig:local
$ wrangler d1 migrations apply vertex --local

⛅️ wrangler 3.60.2
-------------------

Migrations to be applied:
┌─────────────────────────┐
│ name │
├─────────────────────────┤
│ 0000_soft_stellaris.sql │
└─────────────────────────┘
✔ About to apply 1 migration(s)
Your database may not be available to serve requests during the migration, continue? … yes
:cyclone: Executing on local database vertex (23e8bef3-b7e0-4e9e-94ef-447a3b77361b) from .wrangler/state/v3/d1:
:cyclone: To execute on your remote database, add a --remote flag to your wrangler command.
┌─────────────────────────┬────────┐
│ name │ status │
├─────────────────────────┼────────┤
│ 0000_soft_stellaris.sql │ :white_check_mark: │
└─────────────────────────┴────────┘
➜ vertex git:(main) ✗ bun run d1:mig:prod
$ wrangler d1 migrations apply vertex

⛅️ wrangler 3.60.2
-------------------

:white_check_mark: No migrations to apply!
1 Reply
Stigin
StiginOP7mo ago
Hi All, I'm running migrations using the following scripts: "d1:gen": "drizzle-kit generate --config=drizzle.config.ts", "d1:mig:local": "wrangler d1 migrations apply vertex --local", "d1:mig:prod": "wrangler d1 migrations apply vertex" Migrations apply fine to the local D1 instance but finds no migrations for prod despite the database just being spun up with a new schema to apply? Any help much appreciated!! So I fixed this butting the --remote to the script.
Want results from more Discord servers?
Add your server