Skip to content

Commit

Permalink
Fix missing takeys table in new databases
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
chris2511 committed Mar 30, 2024
1 parent cdc9b40 commit 3036c98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/database_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion lib/database_schema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3036c98

Please sign in to comment.