forked from LBRYCommunity/lbry-sdk
Merge pull request #2589 from lbryio/fix-db-migration
fix 11to12 migration typo
This commit is contained in:
commit
dc8e146aa1
2 changed files with 4 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue