Critical: no array / list column type in declarative schema (need text[]) — forces jsonb workarounds

オープン
#78 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
csharp, postgresql
領域
databases

調査の方向性

Start with migrations/schema.yaml and the DataProviderMigrate entry point, then trace how the existing declarative column types are converted into migration operations. Define how an array type and its element type are represented, and verify that a text[] declaration is migrated in one pass without raw SQL or a separate post-migration step.

索引モデルが issue の本文から書いたものです。

説明

Summary

The declarative migration schema (migrations/schema.yaml, applied via DataProviderMigrate) has no array / list column type. There is no way to declare a Postgres text[] (or any T[]) column. This forces a jsonb workaround for every naturally-array-shaped column, which loses array typing, element constraints, and the ability to use Postgres array operators / GIN indexing.

Severity: critical for any schema that needs first-class array columns — it changes the data model (jsonb instead of text[]) and pushes validation that the DB could enforce up into application code.

Where this bit us (real case)

NAP's BYO-IdP end-user auth needs a per-tenant allow-list of permitted JWT signing algorithms — naturally a text[]. There is no array type, so we modelled it as Json (jsonb):

# migrations/schema.yaml
- name: allowed_algs
  type: Json                 # WANTED: a text[] / array type
  isNullable: false
  defaultValue: "'[]'::jsonb"

We could only make this safe because no RLS predicate parses the column — the verifier reads it in Python. If we had needed a DB-side constraint or an array containment check in a policy ('RS256' = ANY(allowed_algs)), jsonb would not have been sufficient and we'd have been stuck.

Types currently available

From a real production schema, the declarative types in use are: BigInt, Boolean, Date, DateTimeOffset, Decimal, Int, Json, Text, Uuid. None expresses an array.

Requested fix

Add a declarative array column type so text[] (and ideally uuid[], int[], etc.) can be expressed without dropping to jsonb. Strawman shape:

- name: allowed_algs
  type: Array
  elementType: Text
  isNullable: false
  defaultValue: "'{}'"

or an inline form such as type: "Text[]". Either is fine — the requirement is simply: a first-class array column type in the declarative schema, migrated the same one-pass way as every other column (no raw SQL / no separate post-migration step, since the consumer's hard rule is "no SQL/DDL in schema.yaml").

Why not just keep using jsonb

  • jsonb arrays can't be used with native array operators (= ANY(...), @> on typed arrays) the way text[] can, including inside RLS policies.
  • jsonb loses element typing — ["RS256", 7, null] is a valid jsonb array; text[] rejects it.
  • It's a silent modelling compromise on every array-shaped column, not a one-off.

Context

Related docs gap: #72 (the documented column-type list is already known to be incomplete). This issue is about the missing capability, not just the docs.

主要言語
C#
スター
68
フォーク
4
平均マージ
50分
マージ済み PR(30日)
2

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Nimblesite/DataProvider のほかの issue

Nimblesite/DataProvider の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。