Environment-based Connection Configs?

Hey y'all! I'm developing a project that will use Cloudflare D1 as the DB. The trouble is that while Drizzle already has native support for querying D1 via the HTTP API, I also want to be able to query against the local version of my DB in the .wrangler directory. Is there any way to be able to switch between which I query, other than having two separate configs I rename(using better-sqlite3 or something)?
4 Replies
Hello, I’m Allie!
Also would be nice to not need this monstrosity:
dbCredentials: {
url: "file://" + resolve("./.wrangler/state/v3/d1/miniflare-D1DatabaseObject/e2acb388179c1d9bd8e89fb6d23bb28f2d966b54bbea2b2b05f1a7d20636b479.sqlite"),
}
dbCredentials: {
url: "file://" + resolve("./.wrangler/state/v3/d1/miniflare-D1DatabaseObject/e2acb388179c1d9bd8e89fb6d23bb28f2d966b54bbea2b2b05f1a7d20636b479.sqlite"),
}
titongo
titongo8mo ago
Hello there, were you able to do this? I'm finding this section of the docs confusing but IIUC this is it, right? https://orm.drizzle.team/docs/get-started-sqlite#cloudflare-d1
Drizzle ORM - SQLite
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Hello, I’m Allie!
Sorry for the slow reply. That’s not quite it, I meant specifically for DrizzleKit Studio
titongo
titongo8mo ago
oh okay thanks
Want results from more Discord servers?
Add your server