forked from LBRYCommunity/lbry-sdk
prevent re-migrating 10 to 11
This commit is contained in:
parent
a2a1ef34ab
commit
c9be79f062
1 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,14 @@ def do_migration(conf):
|
||||||
connection = sqlite3.connect(db_path)
|
connection = sqlite3.connect(db_path)
|
||||||
cursor = connection.cursor()
|
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(
|
cursor.execute(
|
||||||
"pragma foreign_keys=off;"
|
"pragma foreign_keys=off;"
|
||||||
)
|
)
|
||||||
|
@ -32,7 +40,7 @@ def do_migration(conf):
|
||||||
saved_file = 1
|
saved_file = 1
|
||||||
else:
|
else:
|
||||||
download_dir, file_name = None, None
|
download_dir, file_name = None, None
|
||||||
except (OSError, ValueError):
|
except Exception:
|
||||||
download_dir, file_name = None, None
|
download_dir, file_name = None, None
|
||||||
else:
|
else:
|
||||||
download_dir, file_name = None, None
|
download_dir, file_name = None, None
|
||||||
|
|
Loading…
Add table
Reference in a new issue