summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-01-15 10:47:31 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-01-15 10:47:31 +0100
commit8007f2b258a6233eae2249494dbd1c634a7ded86 (patch)
treeb646dda0e81b28f84e1d84081c5e164853d969a5
parentbc50d9ced42d09a8f27433d98d874401a6c3ff15 (diff)
downloadqutebrowser-8007f2b258a6233eae2249494dbd1c634a7ded86.tar.gz
qutebrowser-8007f2b258a6233eae2249494dbd1c634a7ded86.zip
sql: Clean up init slightly
-rw-r--r--qutebrowser/misc/sql.py6
1 files changed, 5 insertions, 1 deletions
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():