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

Aperta
#78 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
csharp, postgresql
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
C#
Stelle
68
Fork
4
Merge medio
50m
PR unite (30g)
2

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Nimblesite/DataProvider

Tutte le issue di Nimblesite/DataProvider

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.