From 8007f2b258a6233eae2249494dbd1c634a7ded86 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 15 Jan 2021 10:47:31 +0100 Subject: sql: Clean up init slightly --- qutebrowser/misc/sql.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/misc/sql.py b/qutebrowser/misc/sql.py index 5cd3246cb..bae9b5aa5 100644 --- a/qutebrowser/misc/sql.py +++ b/qutebrowser/misc/sql.py @@ -192,6 +192,11 @@ def init(db_path): if user_version_changed(): log.sql.debug(f"Migrating from version {_db_user_version} to {_USER_VERSION}") + # Note we're *not* updating the _db_user_version global here. We still want + # user_version_changed() to return True, as other modules (such as history.py) + # use it to create the initial table structure. + Query(f'PRAGMA user_version = {_USER_VERSION.to_int()}').run() + # Enable write-ahead-logging and reduce disk write frequency # see https://sqlite.org/pragma.html and issues #2930 and #3507 # @@ -199,7 +204,6 @@ def init(db_path): # as those are idempotent, let's make sure we run them once again. Query("PRAGMA journal_mode=WAL").run() Query("PRAGMA synchronous=NORMAL").run() - Query(f'PRAGMA user_version = {_USER_VERSION.to_int()}').run() def close(): -- cgit v1.2.3-54-g00ecf