supabase / postgres-meta

A RESTful API for managing your Postgres. Fetch tables, add roles, and run queries
https://supabase.com
Apache License 2.0
941 stars 126 forks source link

feat(typegen): make 1-to-1 relationships detection optional #641

Closed soedirgo closed 1 year ago

soedirgo commented 1 year ago

What kind of change does this PR introduce?

Feature

What is the current behavior?

Can't tailor typegen to PostgREST v9 vs. v10 differences - v9 doesn't support one-to-one relationships

What is the new behavior?

Make one-to-one relationships optional. When we generate the types, e.g. from http://api.supabase.com/api/v1#/projects/getTypescriptTypes , we can check the project's PostgREST version first and detect one-to-one rels only if the project has PostgREST v10+