sqlc
sqlc copied to clipboard
feat: default schema configuration for postgresql
related to https://github.com/sqlc-dev/sqlc/issues/3663
Thanks for taking the time to contribute a PR.
The tests are currently broken. Could you take a look at the failures and se what's up?
@kyleconroy test pass. Thanks
@kyleconroy should I add something more here?
+1
ping @kyleconroy
@kyleconroy any chance to merge it?
We're also using sqlc with a Posgres database with multiple schemas and would love to see this feature. +1
Oh we so need this!
@kyleconroy anything that is needed for this to happen? Happy to help if so.
I'm depending on these fixes for my use case. I'm currently using the fork from @prog8, but since https://github.com/sqlc-dev/sqlc/issues/3916 my workflow is now broken. Is there any chance we can move this PR forward?
@prog8 I'm currently experimenting with versioned schemas as maintained by pgroll. In this scenario, pgroll maintains a secret schema containing the columns used by multiple schema versions, and then exposes a schema called (for example) version_a containing only views, and another schema called version_b containing only views.
Now, I'd like to run sqlc generate specifically on the version_b schema. For this, it's necessary to pass it through sqlc in a way other than the config file. I think it makes sense to use environment variables for this, just like with the database URL - in fact, we could even take the schema_version parameter from the database URL. I think this might make more sense than putting the schema version in the config file (or perhaps we could support both). What do you think about this?
See https://github.com/sqlc-dev/sqlc/pull/3668 for a first, brute-force attempt at this, which does work.