Jure
Jure
Explore posts from servers
CDCloudflare Developers
Created by Sylphritz on 9/19/2023 in #pages-help
Is there a way to connect to D1 locally in, say, a Nuxt.js app in dev mode?
@sylphritz do you mind asking you how do you apply migrations on production D1? From local CLI and wrangler command npx wrangler d1 migrations apply {dbname}? I'm trying to apply migrations in the CF Pages "deploy script" like npm run build && npx wrangler d1 migrations apply {dbname} so migrations would be executed right after deployment / pushing code.
27 replies
CDCloudflare Developers
Created by Sylphritz on 9/19/2023 in #pages-help
Is there a way to connect to D1 locally in, say, a Nuxt.js app in dev mode?
But the biggest issue is that unless you build the project first(or use a binding proxy), then the dev process won't have access to any bindings.
I'm not sure if I understand you correctly... since I'm also a newbie to D1 and the whole development process... but when I run pages dev --d1=DB -- npm run dev I have access to D1 binding --d1=DB and can use local DB over the defined binding.
27 replies
CDCloudflare Developers
Created by Sylphritz on 9/19/2023 in #pages-help
Is there a way to connect to D1 locally in, say, a Nuxt.js app in dev mode?
True, it already persists in the .wrangler/ dir but with "random" path to the db.sqlite. For me is convenient to have manually defined path since I'm using Drizzle Studio https://orm.drizzle.team/drizzle-studio/overview - to be able to define path to DB file in the drizzle.config.ts and then browse the DB with simple command npx drizzle-kit studio.
27 replies
CDCloudflare Developers
Created by Sylphritz on 9/19/2023 in #pages-help
Is there a way to connect to D1 locally in, say, a Nuxt.js app in dev mode?
It would... isn't that what you want for local development?
27 replies
CDCloudflare Developers
Created by Sylphritz on 9/19/2023 in #pages-help
Is there a way to connect to D1 locally in, say, a Nuxt.js app in dev mode?
I'm using this command: npx wrangler pages dev --local --persist-to=./db.sqlite --d1=DB -- npm run dev
27 replies