From 668d07945033ffead05ad3bc73d977583a11021a Mon Sep 17 00:00:00 2001 From: sspanak Date: Sat, 21 Dec 2024 17:34:02 +0200 Subject: [PATCH] removed some more unused code --- .../github/sspanak/tt9/db/sqlite/Migration.java | 16 +++++----------- .../sspanak/tt9/db/sqlite/SQLiteOpener.java | 7 +------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/io/github/sspanak/tt9/db/sqlite/Migration.java b/app/src/main/java/io/github/sspanak/tt9/db/sqlite/Migration.java index ab215876f..8bf85edc3 100644 --- a/app/src/main/java/io/github/sspanak/tt9/db/sqlite/Migration.java +++ b/app/src/main/java/io/github/sspanak/tt9/db/sqlite/Migration.java @@ -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; } } diff --git a/app/src/main/java/io/github/sspanak/tt9/db/sqlite/SQLiteOpener.java b/app/src/main/java/io/github/sspanak/tt9/db/sqlite/SQLiteOpener.java index dfdd3c57f..9abe98852 100644 --- a/app/src/main/java/io/github/sspanak/tt9/db/sqlite/SQLiteOpener.java +++ b/app/src/main/java/io/github/sspanak/tt9/db/sqlite/SQLiteOpener.java @@ -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 + "'. "); } } }