Can't generate migrations using D1 on Cloudflare Workers
There is no way to run migrations while using D1 with Kysely on Cloudflare for 2 reasons:
This is from within a Next.js app running with
Any help would be much appreciated!
- The DB is exposed only at runtime, aka we cannot use the
better-auth CLIto detect the configuration since it's only looking for variables exported (when using D1 we construct the configuration with each request and we only have a function) - The usage of
getMigrationsis still undocumented and probably abandoned since It's returning generic errors from D1 such asError: D1_ERROR: not authorized: SQLITE_AUTH
This is from within a Next.js app running with
Opennext on Cloudflare Workers, everything else better-auth related works like a charm, but if we can't make migration generation is useless, applying the migrations can be done with wrangler against D1, but if we cannot generate the schema according to the current state of the DB we cannot add plugins efficiently by possible knowing what tables to alter and what to add or remove. Any help would be much appreciated!
