Change-Id: Iad4595cb9a12b3ebb23beca092b3057502ef822c
// an empty database file is recognized by sqlite as having user_version 0 but needs no update
// merely applying the schema is enough in that case
if (version || !fileEmpty(dbPath)) {
+ // https://www.sqlite.org/changes.html + https://sqlite.org/src/info/b41031ea2b537237 workaround
+ // automatically ignored for sqlite versions prior to 3.25.2
+ if (unlikely(!dbExec("PRAGMA legacy_alter_table=ON"))) {
+ toStderr("pragma legacy_alter_table failed");
+ return false;
+ }
+
// update-db-to-v$i.sql is stored as dbUpdateScript[$i - 1]
do {
if (unlikely(!dbExec(dbUpdateScript[version]))) {