Closed greg-hammond closed 1 week ago
@AlexBlokh this is the same issue as drizzle-team/drizzle-kit-mirror#422.
The TLDR is that logic in connectToSQLite
gives preference to the presence of @libsql/client
over explicit config to the contrary.
@greg-hammond we don't expect you to use both better-sqlite3
and libsql
, if you're using Turso for remote and local file, you should use libsql
for both of them
Attempting to run
drizzle-kit push
on a local sqlite3 db fails... because my project also has@libsql/client
installed.I have both
better-sqlite3
and@libsql/client
packages installed... as I want to be able to run dev locally or remotely... as well as push locally or remotely. I have different npm scripts that set up aDB_ENV
variable to control how the config operates (see config file below).Inspecting the code in the
connectToSQLite
function - it will attempt to create a libsql client based on the presence of the@libsql/client
package... and so my url field ends up being treated as a real url, rather than my local db location path, and soparseUri
fails withLibsqlError: URL_INVALID: The URL is not in a valid format
.In this case, it seems that checking for the presence of a specific library being installed is a somewhat poor proxy for deciding what to do. Would it be better to drive things more directly from config settings, rather than by checking which package(s) are installed?
versions:
My
drizzle.config.ts
: