Merge pull request #2589 from lbryio/fix-db-migration

fix 11to12 migration typo
This commit is contained in:
Jack Robison 2019-10-28 13:34:41 -04:00 committed by GitHub
commit dc8e146aa1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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")
try:
do_migration(conf)
except Exception as err:
log.info("failed to migrate database: %s", str(err))
except Exception:
log.exception("failed to migrate database")
if os.path.exists(os.path.join(conf.data_dir, "lbrynet.sqlite")):
backup_name = f"rev_{current}_unmigrated_database"
count = 0

View file

@ -40,12 +40,12 @@ def do_migration(conf):
# step 5: transfer content from old to new
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():
added_on = int(time.time())
cursor.execute(
"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