From 203ca22c8e3a7331430e9d8fee3ef88055813502 Mon Sep 17 00:00:00 2001 From: Ahmed El-Helw Date: Sat, 13 Jan 2024 00:03:51 +0400 Subject: [PATCH] Fix column name issue with translation database Older versions of the translation database (versions 2 and 3) added and had a translator_foreign field. In version 4, this was renamed to translatorForeign. The code assumed it was always named as translatorForeign, which is incorrect, thus crashing for people upgrading from older versions. --- .../quran/mobile/translation/databases/2.db | Bin 8192 -> 8192 bytes .../quran/mobile/translation/databases/3.db | Bin 8192 -> 8192 bytes .../quran/mobile/translation/migrations/1.sqm | 4 ++-- .../quran/mobile/translation/migrations/2.sqm | 6 +++--- .../quran/mobile/translation/migrations/3.sqm | 5 +++-- .../quran/mobile/translation/migrations/4.sqm | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/databases/2.db b/common/translation/src/main/sqldelight/com/quran/mobile/translation/databases/2.db index 425d1490681708f114bd890d6e46a6574d1a2dc9..0b46c7c3207eea1900afbe487204f3e39c6edc4f 100644 GIT binary patch delta 71 zcmZp0XmFSyEy%*az`z8=Fu*cV$C#gmL9b{LFHne)pOb-~bF-kpY(B2W5=M4$RaM4j S?a3niolNm*o9FQ-2><|V2Mjg< delta 70 zcmZp0XmFSyEy&2gz`z8=Fu*ub$C#gyL9b{bFHne)pNoN?YqOxh96qkbVn%jxRaM4j R&B?<2os4dq=kX^A003M!3#$MC diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/databases/3.db b/common/translation/src/main/sqldelight/com/quran/mobile/translation/databases/3.db index 76b6421a8432b80fd1ca10e82e20b12b46a9555f..fedc3da40872c49df26c87690ba03979e50be507 100644 GIT binary patch delta 71 zcmZp0XmFSyEy%*az`z8=Fu*cV$C#gmL9b{LFHne)?+XLpm(79#ZG2o!oQ&+^s;Z35 Sp_Bjfbuz`LZSLeR7XSdH5DuRJ delta 70 zcmZp0XmFSyEy&2gz`z8=Fu*ub$C#gyL9b{bFHne)?<)h}*Uf?g?R;EK9E|MZs;Z35 R!IS^-buzkb?&L2Q005HL4io?Y diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/1.sqm b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/1.sqm index 29d9684960..53c103dfcb 100644 --- a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/1.sqm +++ b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/1.sqm @@ -7,12 +7,12 @@ CREATE TABLE IF NOT EXISTS translations ( version INTEGER NOT NULL DEFAULT 0 ); --- adds translatorForeign +-- adds translator_foreign, updated in v2.7.3 CREATE TABLE translations_migration ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, translator TEXT, - translatorForeign TEXT, + translator_foreign TEXT, filename TEXT NOT NULL, url TEXT NOT NULL, version INTEGER NOT NULL DEFAULT 0 diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/2.sqm b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/2.sqm index 69e50d0f6d..1a76a70d1c 100644 --- a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/2.sqm +++ b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/2.sqm @@ -1,9 +1,9 @@ --- adds languageCode +-- adds languageCode - updated in v2.7.5 CREATE TABLE translations_migration ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, translator TEXT, - translatorForeign TEXT, + translator_foreign TEXT, filename TEXT NOT NULL, url TEXT NOT NULL, languageCode TEXT, @@ -11,7 +11,7 @@ CREATE TABLE translations_migration ( ); INSERT INTO translations_migration -SELECT id, name, translator, translatorForeign, filename, url, "", version +SELECT id, name, translator, translator_foreign, filename, url, "", version FROM translations; DROP TABLE translations; diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/3.sqm b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/3.sqm index 311c357b41..0efe75c829 100644 --- a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/3.sqm +++ b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/3.sqm @@ -1,4 +1,5 @@ --- adds minimumRequiredVersion +-- adds minimumRequiredVersion - updated in v2.9.2 +-- renames translator_foreign to translatorForeign also. CREATE TABLE translations_migration ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, @@ -12,7 +13,7 @@ CREATE TABLE translations_migration ( ); INSERT INTO translations_migration -SELECT id, name, translator, translatorForeign, filename, url, languageCode, version, 2 +SELECT id, name, translator, translator_foreign, filename, url, languageCode, version, 2 FROM translations; DROP TABLE translations; diff --git a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/4.sqm b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/4.sqm index da84f45122..cf3386ab2c 100644 --- a/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/4.sqm +++ b/common/translation/src/main/sqldelight/com/quran/mobile/translation/migrations/4.sqm @@ -1,4 +1,4 @@ --- adds userDisplayOrder +-- adds userDisplayOrder, updated in v3.0.2 CREATE TABLE translations_migration ( id INTEGER PRIMARY KEY, name TEXT NOT NULL,