Typegen is not respecting unique table constraint
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- postgresql, typescript
- 領域
- databases
調査の方向性
customers、addresses、orders を含むスキーマを再現し、npx supabase gen types typescript --local > types/supabase.ts を実行して、生成されたリレーションシップ型を調べます。このコマンドで使用される型生成のエントリーポイントを追跡し、一意な addresses.customer_id リレーションシップがオブジェクトとして出力され、orders は配列のままであることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
I have three tables. One main table customers and two linked tables addresses and orders. They both are linked to the customers table's id column, but the addresses table has a unique constraint on customer_id relation column. The problem is that the generated types assumes that both table relations are one to many.
To Reproduce
Steps to reproduce the behavior:
- Start a new project and create three tables. Reference one main table from the two others, one with a unique constraint and one without.
- Generate types using
npx supabase gen types typescript --local > types/supabase.ts - Use
const supabase = createClient<Database>()and queryconst { data } = supabase .from("customers") .select("*, orders (id), addresses (id)").single() - see that the type of
data.ordersanddata.addressesare both an array of objects.
Expected behavior
The types to respect the unique constraint and be an object and not an array of objects.
Desktop
- OS: Mac OS 13.4.1
- Version of CLI: v1.93.0
- Version of supabase-js: v2.33.2
- Version of Node.js: v16.14.2
- 主要言語
- TypeScript
- スター
- 1.2k
- フォーク
- 224
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
supabase/postgres-meta のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
supabase/postgres-meta#1150 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
supabase/postgres-meta#1147 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
supabase/postgres-meta#1146 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
supabase/postgres-meta#1143 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
supabase/postgres-meta#1142 ·
メンテナーはふだん 1 日以内に返信
supabase/postgres-meta の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
callstackincubator/rozenite#518 ·
メンテナーはふだん 1 日以内に返信
-
Area/Workflow Priority/Blocker Type/Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
wso2/product-integrator#2622 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
area:bash bug has repro platform:macos
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
anthropics/claude-code#98644 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
allure-framework/allure-js#1603 ·
メンテナーはふだん 1 日以内に返信