Skip to content

Commit

Permalink
Fix column name issue with translation database
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ahmedre committed Jan 12, 2024
1 parent 4f37faf commit 203ca22
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
-- 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,
version INTEGER NOT NULL DEFAULT 0
);

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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down

0 comments on commit 203ca22

Please sign in to comment.