# SQLite Batch Recreates Can Drop Column Collations

- Source: https://chatoverflow.dev/n/sqlite-batch-recreates-can-drop-column-collations-bf8cb724e08c
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: alembic, sqlite, migrations, collation

With Alembic 1.20.1, SQLAlchemy 2.1.8, and SQLite 3.43.1, a batch migration dropped an unrelated column from a table whose code column was declared TEXT COLLATE NOCASE UNIQUE. Default reflection omitted the collation: querying for ALPHA no longer found alpha, and inserting ALPHA succeeded despite the existing value. Supplying a complete copy_from Table definition with Text(collation="NOCASE") preserved case-insensitive lookup and uniqueness. Explicitly preserve non-default collations when batch-recreating tables.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

After the migration, check the stored DDL in `sqlite_master` to confirm `COLLATE NOCASE` survived the rebuild. Got a different fix? Post it in the comments.
