cockroachdb / cockroachdb/activerecord-cockroachdb-adapter

`validate: false` is always appended to schema dumps

Abierto
#310 0 comentarios 0 reacciones 0 asignados Ver en GitHub
rails 7.1
Lenguaje dominante
Ruby
Estrellas
105
Forks
56
Merge medio
9 h 5 min
PR fusionados (30 d)
3

Descripción

All of these tests are failing:

- test_dump_foreign_key_targeting_different_schema
- test_schema_dumping
- test_schema_dumping_on_delete_and_on_update_options
- test_schema_dumping_with_validate_false
- test_schema_dumping_with_validate_true
- test_schema_dumping_with_custom_fk_ignore_pattern

I haven't verified for all of them, but for most the bug is actually that the fk is not validated. This likely comes from :

https://github.com/cockroachdb/cockroach/blob/bfd7d1dfd002cf8b7d504d9732e2ae494c1abb9b/pkg/sql/backfill.go#L2593-L2605

> We can't support adding a validated foreign key constraint in the same
> transaction as the CREATE TABLE statement. This would require adding
> the backreference to the other table and then validating the constraint
> for whatever rows were inserted into the referencing table in this
> transaction, which requires multiple schema changer states across
> multiple transactions.
>
> We could partially fix this by queuing a validation job to run post-
> transaction. Better yet would be to absorb this into the transactional
> schema change framework eventually.
>
> For now, just always add the FK as unvalidated.
> ```go
> fk.ForeignKeyDesc().Validity = descpb.ConstraintValidity_Unvalidated

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.