fix 11to12 migration typo

This commit is contained in:
Jack Robison 2019-10-28 12:20:15 -04:00
parent 5c1026c745
commit 9200f5b516
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 4 additions and 4 deletions

View file

@ -35,8 +35,8 @@ def migrate_db(conf, start, end):
raise Exception(f"DB migration of version {current} to {current+1} is not available") raise Exception(f"DB migration of version {current} to {current+1} is not available")
try: try:
do_migration(conf) do_migration(conf)
except Exception as err: except Exception:
log.info("failed to migrate database: %s", str(err)) log.exception("failed to migrate database")
if os.path.exists(os.path.join(conf.data_dir, "lbrynet.sqlite")): if os.path.exists(os.path.join(conf.data_dir, "lbrynet.sqlite")):
backup_name = f"rev_{current}_unmigrated_database" backup_name = f"rev_{current}_unmigrated_database"
count = 0 count = 0

View file

@ -40,12 +40,12 @@ def do_migration(conf):
# step 5: transfer content from old to new # step 5: transfer content from old to new
select = "select * from file" select = "select * from file"
for (stream_hash, file_name, download_dir, data_rate, blob_rate, status, saved_file, fee) \ for (stream_hash, file_name, download_dir, blob_rate, status, saved_file, fee) \
in cursor.execute(select).fetchall(): in cursor.execute(select).fetchall():
added_on = int(time.time()) added_on = int(time.time())
cursor.execute( cursor.execute(
"insert into new_file values (?, ?, ?, ?, ?, ?, ?, ?)", "insert into new_file values (?, ?, ?, ?, ?, ?, ?, ?)",
(stream_hash, file_name, download_dir, data_rate, blob_rate, status, saved_file, fee, added_on) (stream_hash, file_name, download_dir, blob_rate, status, saved_file, fee, added_on)
) )
# step 6: drop old table # step 6: drop old table