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
In package.json, include a new script: introspect": "drizzle-kit introspect. This command pulls DDL from an existing database and generates the schema.ts.
import { config } from 'dotenv';
import { defineConfig } from 'drizzle-kit';
config({ path: '.env ' });
export default defineConfig({
schema: './src/db/schema.ts',
out: './drizzle',
dialect: 'sqlite',
dbCredentials: {
user: 'upasana-admin',
password: process.env.DATABASE_PWD, // used admin user's password from the SQLite Cloud dashboard
host: 'chtwalrwiz',
port: 8860,
database: 'chinook.sqlite',
},
});
npm run introspect throws Please provide required params: [x] url: undefined.
Notes
Per this config doc, dbCredentials > SQLiteCredentials, the url can be a path to a local sqlite file. So Drizzle expects a SQLite DB connection string to point to a project DB file.
Drizzle dialects: postgresql, mysql, sqlite.
Drizzle allows 2 ways to set dbCredentials (see steps 4 and 7 above). For non-sqlite dialects, you can use either configuration. However, sqlite dialect only works with url (see step 8 error message).
jacobprall
changed the title
Cannot configure Drizzle Kit with SQLite Cloud DB connection URL
orms / Cannot configure Drizzle Kit with SQLite Cloud DB connection URL
Aug 23, 2024
jacobprall
changed the title
orms / Cannot configure Drizzle Kit with SQLite Cloud DB connection URL
js / Cannot configure Drizzle Kit with SQLite Cloud DB connection URL
Sep 9, 2024
Validation/ Reproduction Steps
In
.env
, setDATABASE_URL
to your SQLite Cloud DB connection string.Create
src/db/index.ts
. Input the following code to connect Drizzle ORM to the database:drizzle.config.ts
in the project root. Input the following code to configure Drizzle Kit with the database connection:In
package.json
, include a new script:introspect": "drizzle-kit introspect
. This command pulls DDL from an existing database and generates theschema.ts
.npm run introspect
throwsLibsqlError: URL_PARAM_NOT_SUPPORTED: Unknown URL query parameter "apikey"
.Update
drizzle.config.ts
with the following code:npm run introspect
throwsPlease provide required params: [x] url: undefined
.Notes
dbCredentials
>SQLiteCredentials
, theurl
can be a path to a local sqlite file. So Drizzle expects a SQLite DB connection string to point to a project DB file.Drizzle allows 2 ways to set
dbCredentials
(see steps 4 and 7 above). For non-sqlite dialects, you can use either configuration. However, sqlite dialect only works withurl
(see step 8 error message).Related Issue(s)
sample content / JavaScript & Drizzle
Screenshots & Videos
N/A.
I'd attach my own project to this comment, but GitHub doesn't allow it. Happy to share over Slack.
The text was updated successfully, but these errors were encountered: