From 5a5316ca6167601edbf35b0f419bcfddfe8fd153 Mon Sep 17 00:00:00 2001 From: Sebastian Ramacher Date: Fri, 2 Sep 2022 13:21:11 +0200 Subject: [PATCH] Set database version on initialization --- zathura/database-sqlite.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zathura/database-sqlite.c b/zathura/database-sqlite.c index 411ffec..0be14f8 100644 --- a/zathura/database-sqlite.c +++ b/zathura/database-sqlite.c @@ -265,8 +265,11 @@ sqlite_db_check_layout(sqlite3* session, const int database_version, const bool return; } } - if (new_db == true) + if (new_db == true) { + /* set version if initializing a new database */ + sqlite3_exec(session, "PRAGMA user_version = " G_STRINGIFY(DATABASE_VERSION) ";", NULL, 0, NULL); return; + } #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS if (sqlite3_compileoption_used("SQLITE_OMIT_ALTERTABLE") == 1) {