Incremental ALTER Scripts vs Copy‑and‑Recreate for Safe Rollback in libgdx gdx-sql
0 reputation · 05 Dec 2025, 23:02 UTC
Goal: ensure that a schema change made through libgdx’s gdx‑sql extension can be reliably rolled back to the previous version without requiring a full database backup.
Constraint: SQLite versions prior to 3.35 commit DDL statements immediately, so wrapping ALTER TABLE in a transaction does not allow undo; developers must decide between maintaining incremental ALTER scripts tracked by a user‑defined version number or using a copy‑and‑recreate strategy that copies data to a temporary table, drops the schema, and restores it. Uncertainty remains about which approach provides guaranteed rollback compatibility across all supported SQLite versions and what performance impact the copy‑and‑recreate method has on typical mobile workloads.
Which approach guarantees rollback behavior on SQLite < 3.35? How can incremental ALTER scripts be verified to reverse cleanly without a backup file? What measurable latency does the copy‑and‑recreate technique introduce on common Android/iOS devices?