You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to apply a migration to the preview database with the command: wrangler d1 migrations apply database-dev
returns the error: [ERROR] Can't find a DB with name/binding 'database-dev' in local config. Check info in wrangler.toml...
The wrangler.toml file has the following configuration: d1_databases = [ { binding = "DATABASE", database_id = "<UUID for database-prod>", database_name = "database-prod", preview_database_id = "<UUID for database-dev>" }, ]
I've worked around the problem by adding the following section to the wrangler.toml file: [env.dev] d1_databases = [ { binding = "DATABASE", database_id = "<UUID for database-dev>", database_name = "database-dev" }, ]
which allows me to apply the migrations by running: wrangler d1 migrations apply -e dev database-dev
I'm not sure if this is how it's supposed to be done. It would be nice to be able to apply the same migrations first to the preview database.
The text was updated successfully, but these errors were encountered:
At the moment there's no nice way to deal with preview databases. The best workaround so far is as you've done - defining the preview database separately in wrangler.toml and manually running migrations on that database first.
What version of
Wrangler
are you using?2.6.2
What operating system are you using?
Mac
Describe the Bug
Trying to apply a migration to the preview database with the command:
wrangler d1 migrations apply database-dev
returns the error:
[ERROR] Can't find a DB with name/binding 'database-dev' in local config. Check info in wrangler.toml...
The wrangler.toml file has the following configuration:
d1_databases = [ { binding = "DATABASE", database_id = "<UUID for database-prod>", database_name = "database-prod", preview_database_id = "<UUID for database-dev>" }, ]
I've worked around the problem by adding the following section to the wrangler.toml file:
[env.dev] d1_databases = [ { binding = "DATABASE", database_id = "<UUID for database-dev>", database_name = "database-dev" }, ]
which allows me to apply the migrations by running:
wrangler d1 migrations apply -e dev database-dev
I'm not sure if this is how it's supposed to be done. It would be nice to be able to apply the same migrations first to the preview database.
The text was updated successfully, but these errors were encountered: