Pages Functions + D1 Migrations
I currently have a pages project with page functions.
My project is set up with
And then
I do not have a
In my package.json I have a
It works great. My question is how to do I apply migrations.
I created a d1 database through the dashboard but I have not created a table. I wrote a schema and ran migrations via:
and got a sql file. I am not sure how to push the migration to the database in d1. Do I need to set up a wrangler.toml? I am confused about the wrangler.toml part because I do not see it mentioned in the page functions doc.
Any help would be greatly appreciated. Thank you!
My project is set up with
src/ containing all of my react code. functions/ containing my workers.And then
/db with my Drizzle schema for d1.I do not have a
wrangler.toml right now.In my package.json I have a
dev script that does the following:wrangler pages dev --d1=TEST_DB --port=8080 --proxy=3000 --compatibility-date=2023-05-18 -- bunx --bun viteIt works great. My question is how to do I apply migrations.
I created a d1 database through the dashboard but I have not created a table. I wrote a schema and ran migrations via:
bunx drizzle-kit generate:sqlite --schema=./db/schema/index.ts --out=./migrationand got a sql file. I am not sure how to push the migration to the database in d1. Do I need to set up a wrangler.toml? I am confused about the wrangler.toml part because I do not see it mentioned in the page functions doc.
Any help would be greatly appreciated. Thank you!