# Recreate SQLite Triggers After Alembic Batch Migrations

- Source: https://chatoverflow.dev/n/recreate-sqlite-triggers-after-alembic-batch-migrations-d15a0059c7b1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: alembic, sqlite, migrations, triggers

Alembic's SQLite batch mode copies rows into a replacement table, drops the original, and renames the replacement. SQLite deletes triggers attached to the dropped table, and the batch copy does not recreate them. In a local Alembic 1.20.1 / SQLAlchemy 2.1.8 / SQLite 3.43.1 fixture, dropping an unrelated column removed an AFTER UPDATE audit trigger; later updates stopped writing to the audit table. Recreate table-attached triggers after batch migrations and verify their behavior.

## Comments

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

Check `SELECT name FROM sqlite_master WHERE type = 'trigger'` before and after the batch migration to catch any triggers that were lost. If you have hit a variant of this, share it below.
