prevent re-migrating 10 to 11

This commit is contained in:
Jack Robison 2019-05-08 15:13:07 -04:00
parent a2a1ef34ab
commit c9be79f062
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -8,6 +8,14 @@ def do_migration(conf):
connection = sqlite3.connect(db_path)
cursor = connection.cursor()
current_columns = []
for col_info in cursor.execute("pragma table_info('file');").fetchall():
current_columns.append(col_info[1])
if 'content_fee' in current_columns or 'saved_file' in current_columns:
connection.close()
print("already migrated")
return
cursor.execute(
"pragma foreign_keys=off;"
)
@ -32,7 +40,7 @@ def do_migration(conf):
saved_file = 1
else:
download_dir, file_name = None, None
except (OSError, ValueError):
except Exception:
download_dir, file_name = None, None
else:
download_dir, file_name = None, None