Skip to content

Commit

Permalink
Move manual migration from SyncManager to android_manual_migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
antweb committed Dec 13, 2024
1 parent 6908d81 commit 4961670
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ public static void migrate(DataSource dataSource, boolean dbIsNew) throws SQLExc
}

public static void android_manual_migrations(Connection c, int oldVersion, int newVersion) throws SQLException {
if (oldVersion < 58 && newVersion >= 58) {
execIgnore(c, "UPDATE checkin SET listId = list WHERE (listId IS NULL OR listID = 0) AND list IS NOT NULL AND list > 0", new String[] {"no such column", "existiert", "syntax error"});
}
if (oldVersion < 87 && newVersion >= 87) {
execIgnore(c, "CREATE INDEX receipt_open ON receipt (open) WHERE open = 1;", new String[] {"already exists", "existiert bereits"});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,6 @@ private void bumpKnownVersion() {
configStore.setLastFailedSync(System.currentTimeMillis());
configStore.setLastFailedSyncMsg(e.getMessage());
}

// This is kind of a manual migration, added in 2020-19. Remove at some late point in time
try {
dataStore.raw("UPDATE checkin SET listId = list WHERE (listId IS NULL OR listID = 0) AND list IS NOT NULL AND list > 0");
} catch (Exception e) {
// old column doesn't exist? ignore!
}
}

protected void upload(ProgressFeedback feedback) throws SyncException {
Expand Down

0 comments on commit 4961670

Please sign in to comment.