forked from LBRYCommunity/lbry-sdk
fix 11to12 migration typo
This commit is contained in:
parent
5c1026c745
commit
9200f5b516
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")
|
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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue