From baf25b2a3e376c2da84056e4e7e20c3441a0e13a Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 17 May 2021 21:24:46 -0400 Subject: [PATCH] Added a check if column exist in table before trying to remove it during the database migration routine. --- bazarr/database.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bazarr/database.py b/bazarr/database.py index 3513194b0..1e33edc78 100644 --- a/bazarr/database.py +++ b/bazarr/database.py @@ -272,6 +272,12 @@ def db_upgrade(): for column in columnToRemove: try: + # Check if column still exist in table + columns_dict = database.execute('''PRAGMA table_info('{0}')'''.format(column[0])) + columns_names_list = [x['name'] for x in columns_dict] + if column[1] not in columns_names_list: + continue + table_name = column[0] column_name = column[1] tables_query = database.execute("SELECT name FROM sqlite_master WHERE type = 'table'")