Skip to content

Commit

Permalink
removed some more unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
sspanak committed Dec 22, 2024
1 parent 2898db0 commit 668d079
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
16 changes: 5 additions & 11 deletions app/src/main/java/io/github/sspanak/tt9/db/sqlite/Migration.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,21 @@
class Migration {
static final Migration[] LIST = {
new Migration(
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN fileHash TEXT NOT NULL DEFAULT 0",
true
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN fileHash TEXT NOT NULL DEFAULT 0"
),
new Migration(
"ALTER TABLE " + Tables.LANGUAGES_META + " RENAME COLUMN normalizationPending TO _delete_me_0",
true
"ALTER TABLE " + Tables.LANGUAGES_META + " RENAME COLUMN normalizationPending TO _delete_me_0"
),
new Migration(
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN positionsToNormalize TEXT NULL",
true
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN positionsToNormalize TEXT NULL"
),
new Migration(
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN maxWordsPerSequence INTEGER NOT NULL DEFAULT -1",
true
"ALTER TABLE " + Tables.LANGUAGES_META + " ADD COLUMN maxWordsPerSequence INTEGER NOT NULL DEFAULT -1"
)
};

final String query;
final boolean mayFail;
private Migration(String query, boolean mayFail) {
private Migration(String query) {
this.query = query;
this.mayFail = mayFail;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL(migration.query);
Logger.d(LOG_TAG, "Migration succeeded: '" + migration.query);
} catch (Exception e) {
if (migration.mayFail) {
Logger.e(LOG_TAG, "Ignoring migration: '" + migration.query + "'. ");
} else {
Logger.e(LOG_TAG, "Migration failed: '" + migration.query + "'. " + e.getMessage() + "\nAborting all subsequent migrations.");
break;
}
Logger.e(LOG_TAG, "Ignoring migration: '" + migration.query + "'. ");
}
}
}
Expand Down

0 comments on commit 668d079

Please sign in to comment.