ts-safeql / safeql

Validate and auto-generate TypeScript types from raw SQL queries in PostgreSQL.
https://safeql.dev
MIT License
1.32k stars 22 forks source link

Add info around dropdb and createdb #245

Closed georgesmith46 closed 1 month ago

georgesmith46 commented 1 month ago

Is your feature request related to a problem? Please describe. I was recently trying to use the migrationsDir config option to handle migrations but when running ESLint, it would just hang indefinitely with no message. Looking into the code I found that as part of the migrations, the dropdb and createdb binaries are used. After installing these everything worked fine.

Describe the solution you'd like It's probably worth mentioning in the docs that these binaries need exist in order for migrations to work, or throw an error if they don't exist.

Newbie012 commented 1 month ago

Usually when installing postgresql, dropdb and createdb should be available. I haven't stumbled across a case where they weren't in PATH.

I agree that it should probably be mentioned in the docs. PRs are welcome :)

georgesmith46 commented 1 month ago

Thanks for the quick response. I was thinking that an alternative solution would be to switch these calls to use CREATE/DROP DATABASE SQL commands instead. This would mean the postgresql binaries wouldn't need to be installed at all in order to use this tool. Do you think this is a viable option? I'd be happy to raise a PR for this.

The situation I'm currently in is I'd like to use this in my company's CI pipeline, but there are heavy restrictions on what can be installed.

Newbie012 commented 1 month ago

That would make sense, go for it :)