Pages Functions + D1 Migrations

I currently have a pages project with page functions. 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 vite 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: bunx drizzle-kit generate:sqlite --schema=./db/schema/index.ts --out=./migration 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!
2 Replies
boywonder350
boywonder350•9mo ago
oh wait... do I just push the migrations folder to my repo and then it will show up when I do bunx wrangler d1 migrations list ... and then I can apply it? 😮
chefgaben
chefgaben•5mo ago
Did anyone find out the answer to this?