Locally it works (using the binding name) - I've now tested with the DB name and it works as well lo
Locally it works (using the binding name) - I've now tested with the DB name and it works as well locally, but I get the same error while deploying.
17:09:38.403 > db:migrate-remote
17:09:38.403 > npx wrangler d1 migrations apply db-prod --remote
17:09:38.404
17:09:39.845 ⛅️ wrangler 3.52.0
17:09:39.845 -------------------
17:09:41.463 Failed: Error while executing user command. Exited with error code: 1
17:09:41.473 Failed: build command exited with code: 1
17:09:42.674 Failed: error occurred while running build commandWRANGLER_LOG=debug and hopefully you'll see what's going wrong WRANGLER_LOG=debug the other error was just too vague

env.DB.prepare(...) is just an object, it has almost nothing to do with SQLite. It is sent to your database, which makes a prepared statement with the SQL text and binds it with your parameters.prepare both times, of course)
WRANGLER_LOG=debugWRANGLER_LOG=debug17:21:21.937 🪵 Writing logs to "/opt/buildhome/.config/.wrangler/logs/wrangler-2024-04-26_15-21-21_813.log"
17:21:21.938 Failed to load .env file ".env": Error: ENOENT: no such file or directory, open '.env'
17:21:21.938 at Object.openSync (node:fs:603:3)
17:21:21.938 at Object.readFileSync