Are there any postgres migration libs that work on pages?
I use drizzle as an orm and it has a postgres-js adapter which works fine. but when I try to apply migrations using that adapter, cloudflare throws build errors because the migration client uses node:fs, which isnt supported on pages.
Are there any alternative ways to apply sql migration files to my postgres database?
4 Replies
do you have node compat enabled
alternative ways:
1. manually run migrations
2. run migrations in CI
Yes, I have the nodejs_compat flag in the pages settings. Currently I just manually run the migrations through the connection string with my client. Exploring alternative migration tools that could hopefully automate this though.
ohh, I know why when I think about it
workers are just one .js file, and run in a context without a filesystem
so no fs api is integrated (other than workers sites/adding them at build time)
I'd go with a ci pipeline that runs them
for me, doing it manually isn't that big of a chore — you only need migrations when you change the schema
Honestly this seems like the move. Migrations rarely happen so doing them manually isn't that big of a deal. I'll probably not waste any more time on this and just continue manually migrating. Thanks for your time and help!