Bonadio
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database

15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
You need to run wrangler dev and access any route that make a call to the database the first time it will be blank and the call will fail but it will create the sqlite file.
them you can open it and create the tables. In dev I create my tables using drizzle generate than I copy and paste the SQL in "DB Browser Sqlite" to create the tables
15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
At you project there will be a hidden folder .wrangler if you expand it there will be a d1 subfolder and the sqlite file will be there.
15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
Yes, only one db instance in wangler.
and this is my drizzle config
import type { Config } from 'drizzle-kit'
export default {
schema: './app/db/customerSchema.ts',
out: './drizzle',
} satisfies Config
15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
You define a single DB, when you run on dev the DB is a local sqlite in your hard drive. On the server is D1
15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
I apply my middeware in the beginning with
app.use('*', dbMiddleware)
Before I define the routes
15 replies
CDCloudflare Developers
•Created by Sithu Khant on 2/13/2025 in #workers-help
Svelte, Hono, and D1 database
Create a file called InitDb.ts
Then in your middleware do
In your routes
15 replies