diff --git a/lbry/extras/daemon/migrator/dbmigrator.py b/lbry/extras/daemon/migrator/dbmigrator.py index a2b1211e7..7542adab9 100644 --- a/lbry/extras/daemon/migrator/dbmigrator.py +++ b/lbry/extras/daemon/migrator/dbmigrator.py @@ -37,6 +37,8 @@ def migrate_db(conf, start, end): from .migrate13to14 import do_migration elif current == 14: from .migrate14to15 import do_migration + elif current == 15: + from .migrate15to16 import do_migration else: raise Exception(f"DB migration of version {current} to {current+1} is not available") try: diff --git a/lbry/extras/daemon/migrator/migrate15to16.py b/lbry/extras/daemon/migrator/migrate15to16.py new file mode 100644 index 000000000..0c2d9da41 --- /dev/null +++ b/lbry/extras/daemon/migrator/migrate15to16.py @@ -0,0 +1,17 @@ +import os +import sqlite3 + + +def do_migration(conf): + db_path = os.path.join(conf.data_dir, "lbrynet.sqlite") + connection = sqlite3.connect(db_path) + cursor = connection.cursor() + + cursor.executescript(""" + update blob set should_announce=0 + where should_announce=1 and + blob.blob_hash in (select stream_blob.blob_hash from stream_blob where position=0); + """) + + connection.commit() + connection.close()