mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 08:45:59 +01:00
Add zoom column to sqlite database if missing
This commit is contained in:
parent
4f3837c372
commit
09d8a37c8e
1 changed files with 13 additions and 0 deletions
|
@ -184,6 +184,10 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
|
|||
static const char SQL_FILEINFO_ALTER3[] =
|
||||
"ALTER TABLE fileinfo ADD COLUMN time TIMESTAMP;";
|
||||
|
||||
/* update fileinfo table (part 4) */
|
||||
static const char SQL_FILEINFO_ALTER4[] =
|
||||
"ALTER TABLE fileinfo ADD COLUMN zoom FLOAT;";
|
||||
|
||||
/* update bookmark table */
|
||||
static const char SQL_BOOKMARK_ALTER[] =
|
||||
"ALTER TABLE bookmarks ADD COLUMN hadj_ratio FLOAT;"
|
||||
|
@ -234,6 +238,15 @@ sqlite_db_init(ZathuraSQLDatabase* db, const char* path)
|
|||
}
|
||||
}
|
||||
|
||||
ret1 = check_column(session, "fileinfo", "zoom", &res1);
|
||||
|
||||
if (ret1 == true && res1 == false) {
|
||||
girara_debug("old database table layout detected; updating ...");
|
||||
if (sqlite3_exec(session, SQL_FILEINFO_ALTER4, NULL, 0, NULL) != SQLITE_OK) {
|
||||
girara_warning("failed to update database table layout");
|
||||
}
|
||||
}
|
||||
|
||||
ret1 = check_column(session, "bookmarks", "hadj_ratio", &res1);
|
||||
ret2 = check_column(session, "bookmarks", "vadj_ratio", &res2);
|
||||
|
||||
|
|
Loading…
Reference in a new issue