Test that the migration chain keeps the expression indexes (B-97, DAT-75, DAT-56, ARC-62)
batch_alter_table on SQLite rebuilds the table and silently drops ix_rounds_single_active and ix_users_username_lower, autogenerate never sees them, and no test ran the migrations (the others build the schema with create_all). tests/unit/test_migrations.py runs `alembic upgrade head` on an empty file DB in a subprocess and asserts both indexes exist with their definition (read from sqlite_master) and that a second active round and a case-variant username are refused. Verified to fail when a batch_alter_table on rounds is added to the last migration. The current chain already preserves both indexes, so no migration changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
daec4749c2
commit
cc63753439
7 files changed
+90
-26
No files matched your search
@@ -1453,9 +1453,8 @@ letti con una scansione completa.
|
||||
secondo username uguale a meno delle maiuscole vengano rifiutati con
|
||||
`IntegrityError`. Il test gira con la suite unitaria, quindi una migrazione
|
||||
che perde uno dei due indici non entra nel repository.
|
||||
*Codice:* `migrations/env.py` · *Test:* —
|
||||
*Stato:* da implementare (B-97) · *Oggi:* nessun test esegue le migrazioni
|
||||
(vedi sotto).
|
||||
*Codice:* `migrations/env.py` ·
|
||||
*Test:* `tests/unit/test_migrations.py`
|
||||
|
||||
- **[DAT-57]** Una migrazione che incontra dati incompatibili con un nuovo
|
||||
vincolo si comporta in uno di due modi. Se esiste una correzione **senza
|
||||
@@ -1477,10 +1476,9 @@ letti con una scansione completa.
|
||||
l'indice. È la stessa scelta che `get_active_round` faceva già in silenzio.
|
||||
*Codice:* `migrations/versions/8a1c4e7b2d90_add_failure_reason_and_single_active_round_index.py`
|
||||
|
||||
Oggi nessun test esegue le migrazioni: i test unitari creano lo schema
|
||||
direttamente dal modello (`Base.metadata.create_all`), quindi verificano il
|
||||
modello, non la catena di revisioni. [DAT-75] (B-97) aggiunge il primo test
|
||||
sulla catena.
|
||||
I test unitari creano lo schema direttamente dal modello
|
||||
(`Base.metadata.create_all`), quindi verificano il modello, non la catena di
|
||||
revisioni; [DAT-75] aggiunge il test che esegue la catena su un database vuoto.
|
||||
|
||||
### Storia dello schema
|
||||
|
||||
|
||||
Reference in new issue
Block a user