-
Notifications
You must be signed in to change notification settings - Fork 265
feat(typegen): add postgrest-version params #3602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
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 |
@@ -106,6 +110,7 @@ func init() { | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we can deprecate the v9 compat flag with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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