Skip to content

Commit

Permalink
Merge pull request #10 from RBusarow/support_API_30_table_renames
Browse files Browse the repository at this point in the history
enable PRAGMA legacy_alter_table for table renames in API 30+ / SQLite 3.25.2+
  • Loading branch information
RBusarow authored Aug 6, 2020
2 parents 76ba554 + 1175616 commit e3fe0c2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e3fe0c2

Please # to comment.