Drizzle-kit migrations in Cloudflare Environment With Vitest
Using Vitest’s Cloudflare pool (which runs Miniflare) with PGlite, how can I run Drizzle migrations per test file? The usual migrate(db, { migrationsFolder }) or drizzle-kit push fails because Miniflare workers can’t access the filesystem.
I was opting to use PGLite so I could have isolated databases and keep my tests running concurrently. But this would require being able to run migrations per file instead of in a global setup which would have access to the full node api suite.
Is there an officially supported way to run migrations from in-memory or bundled SQL, or a recommended approach for Cloudflare test environments?”
1 Reply
When you generate a migration with drizzle-kit, it produces SQL migration files that you can just run yourself however you see fit.