Fix missing takeys table in new databases

The "takeys" table was only created for existing databases.

New databases were immediately marked as version "8" databases
and the tykeys table creation was skipped.
This commit is contained in:
Christian Hohnstaedt 2024-03-30 12:47:17 +01:00
parent 582ee06a2d
commit f3ed7ef09e
2 changed files with 6 additions and 2 deletions

View File

@ -73,7 +73,11 @@ const QString &database_model::detect_provider()
QSqlError database_model::initSqlDB()
{
#define MAX_SCHEMAS 8
#define SCHEMA_VERSION "8"
/* The initial SQL creation data creates a version "7"
* database. Then an update to Version 8 by creating "takeys"
* is executed.
*/
#define INITIAL_SCHEMA_VERSION "7"
QStringList schemas[MAX_SCHEMAS];

View File

@ -32,7 +32,7 @@
<< "CREATE TABLE settings ("
"key_ CHAR(20) UNIQUE, " // mySql does not like 'key' or 'option"
"value " B64_BLOB ")"
<< "INSERT INTO settings (key_, value) VALUES ('schema', '" SCHEMA_VERSION "')"
<< "INSERT INTO settings (key_, value) VALUES ('schema', '" INITIAL_SCHEMA_VERSION "')"
/*
* All items (keys, tokens, requests, certs, crls, templates)