feat(typegen): add postgrest-version params#3602
Conversation
Should be merged once: https://github.com/supabase/postgres-meta/pull/948/files is merged
31ed7fa to
045334b
Compare
Pull Request Test Coverage Report for Build 16189480091Details
💛 - Coveralls |
| typeFlags.StringSliceVarP(&schema, "schema", "s", []string{}, "Comma separated list of schema to include.") | ||
| typeFlags.Var(&swiftAccessControl, "swift-access-control", "Access control for Swift generated types.") | ||
| typeFlags.BoolVar(&postgrestV9Compat, "postgrest-v9-compat", false, "Generate types compatible with PostgREST v9 and below. Only use together with --db-url.") | ||
| typeFlags.StringVar(&postgrestVersion, "postgrest-version", "", "Generate types with __InternalSupabase schema using the right version of postgrest. Only use together with --db-url.") |
There was a problem hiding this comment.
I wonder if we can deprecate the v9 compat flag with this?
There was a problem hiding this comment.
I think we can infer v9 automatically from the postgrestVersion. Just wonder if that might break some user commands 🤔
| // Extract version from image tag and trim 'v' prefix | ||
| postgrestVersion = strings.TrimPrefix(utils.Config.Api.Image, "postgrest/postgrest:v") | ||
|
|
There was a problem hiding this comment.
Can we move this to its own check that also applies to remote database?
| // Extract version from image tag and trim 'v' prefix | |
| postgrestVersion = strings.TrimPrefix(utils.Config.Api.Image, "postgrest/postgrest:v") | |
| if len(postgrestVersion) == 0 { | |
| // Extract version from image tag and trim 'v' prefix | |
| postgrestVersion = strings.TrimPrefix(utils.Config.Api.Image, "postgrest/postgrest:v") | |
| } |
There was a problem hiding this comment.
Hum I don't get it, for remote we'll hit the api endpoint to get the type generated. We need this for local types gen only for "dev/local" databases don't we ? 🤔
There was a problem hiding this comment.
It's also possible to connect to remote db via direct connection string, via --db-url flag. Although it's more common to hit our hosted api like you mentioned.
Another use case is connecting to self hosted db that's not on localhost.
Should be merged once: https://github.com/supabase/postgres-meta/pull/948/files is merged