Pre-release migrations

This commit is contained in:
Mark Qvist 2026-10-31 13:46:30 +01:00
parent d45a5860fd
commit fe2fe94dd8
No known key found for this signature in database

View file

@ -262,11 +262,20 @@ class KnownDestinationsStore:
ratchet BLOB NOT NULL,
received REAL NOT NULL)""")
# Pre-release migrations, will be folded into finalized schema befor 1.6.0 release
if 0 < db_version < 2: self._conn.execute("ALTER TABLE known_destinations ADD COLUMN lr_cost REAL")
self._conn.execute("PRAGMA user_version = 2")
self._conn.commit()
try:
# Pre-release migrations, will be folded into finalized schema before 1.6.0 release
if 0 < db_version < 2: self._conn.execute("ALTER TABLE known_destinations ADD COLUMN lr_cost REAL")
if 0 < db_version < 3: self._conn.execute("ALTER TABLE known_destinations ALTER COLUMN packet_hash DROP NOT NULL")
self._conn.execute("PRAGMA user_version = 3")
self._conn.commit()
except Exception as e:
import RNS
RNS.log(f"Pre-release database migration failed: {e}", RNS.LOG_CRITICAL)
RNS.log(f"You will need to remove the known_destinations.db* files from your storage directory", RNS.LOG_CRITICAL)
RNS.log(f"On the next instance start, the database will be rebuilt", RNS.LOG_CRITICAL)
RNS.log(f"Exiting now", RNS.LOG_CRITICAL)
time.sleep(1)
RNS.panic()
def __entry_row(self, destination_hash, entry):
stamp = entry[5] if len(entry) > 5 else None