diff --git a/RoomigrantCompiler/src/main/java/dev/matrix/roomigrant/compiler/Migration.kt b/RoomigrantCompiler/src/main/java/dev/matrix/roomigrant/compiler/Migration.kt index 5d4e29e..06ce0b7 100644 --- a/RoomigrantCompiler/src/main/java/dev/matrix/roomigrant/compiler/Migration.kt +++ b/RoomigrantCompiler/src/main/java/dev/matrix/roomigrant/compiler/Migration.kt @@ -67,6 +67,12 @@ class Migration( createTableIndices(tableDiff.new) } + val pendingTableRename = diff.changedTables.any { it.fieldsDiff.wasChanged || it.nameChanged } + + if (pendingTableRename) { + execSql("PRAGMA legacy_alter_table=ON;") + } + for (tableDiff in diff.changedTables) { val table1 = tableDiff.old val table2 = tableDiff.new