Skip to content

Commit 3ee3e7f

Browse files
committed
add migrator to set head blobs should_announce=0
1 parent c158b29 commit 3ee3e7f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

lbry/extras/daemon/migrator/dbmigrator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ def migrate_db(conf, start, end):
3737
from .migrate13to14 import do_migration
3838
elif current == 14:
3939
from .migrate14to15 import do_migration
40+
elif current == 15:
41+
from .migrate15to16 import do_migration
4042
else:
4143
raise Exception(f"DB migration of version {current} to {current+1} is not available")
4244
try:
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import os
2+
import sqlite3
3+
4+
5+
def do_migration(conf):
6+
db_path = os.path.join(conf.data_dir, "lbrynet.sqlite")
7+
connection = sqlite3.connect(db_path)
8+
cursor = connection.cursor()
9+
10+
cursor.executescript("""
11+
update blob set should_announce=0
12+
where should_announce=1 and
13+
blob.blob_hash in (select stream_blob.blob_hash from stream_blob where position=0);
14+
""")
15+
16+
connection.commit()
17+
connection.close()

0 commit comments

Comments
 (0)