Skip to content
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

feat(typegen): support --postgrest-v9-compat for --db-url #1817

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

soedirgo
Copy link
Member

@soedirgo soedirgo commented Jan 5, 2024

What kind of change does this PR introduce?

feature

What is the current behavior?

When running supabase gen types typescript with --db-url, we can't check which PostgREST version the client lib will query against, and unfortunately PostgREST v10 has a breaking change which changes the format of a nested table for one-to-one relationships from T[] to T | null. The generated types can only support one or the other.

For the hosted platform and local dev this isn't an issue since we can detect the PostgREST version and switch between the 2 formats accordingly, but for --db-url we need this to be configurable.

What is the new behavior?

Add --postgrest-v9-compat flag, which can only be used in conjunction with --db-url.

@soedirgo soedirgo requested a review from a team as a code owner January 5, 2024 06:26
cmd/gen.go Outdated Show resolved Hide resolved
@soedirgo soedirgo force-pushed the feat/detect-o2o-flag branch from b0be707 to c0f26e7 Compare January 9, 2024 08:18
@soedirgo
Copy link
Member Author

soedirgo commented Jan 9, 2024

Updated to use --postgrest-v9-compat

@soedirgo soedirgo force-pushed the feat/detect-o2o-flag branch from c0f26e7 to b19551b Compare January 9, 2024 08:19
@soedirgo soedirgo changed the title feat(typegen): support --detect-o2o-relationships for --db-url feat(typegen): support --postgrest-v9-compat for --db-url Jan 9, 2024
@sweatybridge sweatybridge merged commit bdd09b4 into main Jan 10, 2024
9 checks passed
@sweatybridge sweatybridge deleted the feat/detect-o2o-flag branch January 10, 2024 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants