DataProvider: AddColumn with inline checkConstraint duplicates check on subsequent migrate
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 50/100
Línea de trabajo
Start with DataProviderMigrate and the AddColumnOperation path that handles column-level checkConstraint values; reproduce the schema from the issue against Postgres and inspect the generated DDL. Add or update coverage for the migration, then verify that one named check constraint is created and a subsequent migrate succeeds without a duplicate-constraint error.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Tool: DataProviderMigrate (CLI)
Version: latest as of 2026-05-20 (installed via dotnet tool)
Provider: postgres (Supabase)
Symptom
A migrate --allow-destructive run fails with:
Error: migration apply failed: 42710: constraint "tenant_credit_event_kind_chk" for relation "tenant_credit_event" already exists
…even when starting from a state where the column and the constraint do not yet exist (verified via information_schema.columns + pg_constraint before the run).
Schema
- name: tenant_credit_event
columns:
- name: kind
type: Text
isNullable: false
checkConstraint: "kind IN ('topup','spend','refund','adjustment')"
Hypothesis
AddColumnOperation with an inline checkConstraint appears to emit two
DDL statements in the same transaction:
ALTER TABLE … ADD COLUMN kind text NOT NULL(which Postgres auto-names the
inline constraint, e.g.tenant_credit_event_kind_check)ALTER TABLE … ADD CONSTRAINT tenant_credit_event_kind_chk CHECK (kind IN (…))
The second emit collides because the inline form was already applied — OR
DataProvider is emitting the named CONSTRAINT twice in a single batch.
Same shape visible on usage_events where prod has both
usage_events_kind_check AND usage_events_kind_chk (and equivalent
duplicates for charged_micro_usd, vendor_micro_usd, quantity). That's
the smoking gun — a previous successful run left one of each pair behind,
proving DataProvider is creating two constraints per column-level
checkConstraint.
Workaround used (prod hotfix)
Manually applied missing schema deltas via raw SQL (per user authorization
in the credit-billing rollout):
ALTER TABLE … ADD COLUMN kind text NOT NULL(no inline check)ALTER TABLE … ADD CONSTRAINT tenant_credit_event_kind_chk CHECK …(named, once)- Renamed
usage_events.ledger_id → credit_event_id DROP TABLE wallet_ledger,DROP TABLE wallet- Replaced two combined RLS policies with the four single-op ones declared
inmigrations/schema.yaml.
Ask
Either:
- Emit only the named constraint from
checkConstraint:and skip the
inline form, OR - Detect existing equivalent check constraints (same predicate / same
relation) and treat as a no-op when re-applying.
Cross-refs
- NAP incident: Nimblesite/NimblesiteAgenticPlatform#126
- PR that triggered: Nimblesite/NimblesiteAgenticPlatform#125
- Lenguaje dominante
- C#
- Estrellas
- 68
- Forks
- 4
- Merge medio
- 50 min
- PR fusionados (30 d)
- 2
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Nimblesite/DataProvider
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 92/100
Nimblesite/DataProvider#137 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Nimblesite/DataProvider#72 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Nimblesite/DataProvider#121 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Nimblesite/DataProvider#108 ·
Los mantenedores suelen responder en 1 día
-
A check constraint the schema cannot name can never be retired, and keeps enforcing the old ruleAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Nimblesite/DataProvider#107 ·
Los mantenedores suelen responder en 1 día
Todos los issues de Nimblesite/DataProvider
Issues similares
-
kronos:develop:queued priority:P0
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
nopSolutions/nopCommerce#8512 ·
Los mantenedores suelen responder en 4 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
modelcontextprotocol/csharp-sdk#2061 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día