diff --git a/lbry/lbry/extras/daemon/Components.py b/lbry/lbry/extras/daemon/Components.py index 98b1d5250..66d9acd9b 100644 --- a/lbry/lbry/extras/daemon/Components.py +++ b/lbry/lbry/extras/daemon/Components.py @@ -50,7 +50,7 @@ class DatabaseComponent(Component): @staticmethod def get_current_db_revision(): - return 13 + return 14 @property def revision_filename(self): diff --git a/lbry/lbry/extras/daemon/migrator/dbmigrator.py b/lbry/lbry/extras/daemon/migrator/dbmigrator.py index 99a1bb2b4..726cc1974 100644 --- a/lbry/lbry/extras/daemon/migrator/dbmigrator.py +++ b/lbry/lbry/extras/daemon/migrator/dbmigrator.py @@ -33,6 +33,8 @@ def migrate_db(conf, start, end): from .migrate11to12 import do_migration elif current == 12: from .migrate12to13 import do_migration + elif current == 13: + from .migrate13to14 import do_migration else: raise Exception(f"DB migration of version {current} to {current+1} is not available") try: diff --git a/lbry/lbry/extras/daemon/migrator/migrate13to14.py b/lbry/lbry/extras/daemon/migrator/migrate13to14.py new file mode 100644 index 000000000..5cbd6d3fa --- /dev/null +++ b/lbry/lbry/extras/daemon/migrator/migrate13to14.py @@ -0,0 +1,21 @@ +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(""" + create table if not exists peer ( + node_id char(96) not null primary key, + address text not null, + udp_port integer not null, + tcp_port integer, + unique (address, udp_port) + ); + """) + + connection.commit() + connection.close()