From c9be79f0629c20f083ef587b3d551b25970498a6 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 8 May 2019 15:13:07 -0400 Subject: [PATCH] prevent re-migrating 10 to 11 --- lbrynet/extras/daemon/migrator/migrate10to11.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lbrynet/extras/daemon/migrator/migrate10to11.py b/lbrynet/extras/daemon/migrator/migrate10to11.py index a8a9ef7ba..9974c785c 100644 --- a/lbrynet/extras/daemon/migrator/migrate10to11.py +++ b/lbrynet/extras/daemon/migrator/migrate10to11.py @@ -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