2020-03-16 22:37:04 +01:00
|
|
|
/**
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>
|
2021-04-08 13:16:36 +02:00
|
|
|
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
|
2020-03-16 22:37:04 +01:00
|
|
|
*
|
2020-08-14 20:56:04 +02:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2020-03-16 22:37:04 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QSqlQuery>
|
|
|
|
|
2020-05-26 16:32:07 +02:00
|
|
|
class Database : public QObject
|
2020-03-16 22:37:04 +01:00
|
|
|
{
|
2020-05-26 16:32:07 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2020-03-16 22:37:04 +01:00
|
|
|
public:
|
|
|
|
static Database &instance()
|
|
|
|
{
|
|
|
|
static Database _instance;
|
|
|
|
return _instance;
|
|
|
|
}
|
|
|
|
bool execute(QSqlQuery &query);
|
2020-11-01 13:18:11 +01:00
|
|
|
bool execute(const QString &query);
|
2020-03-16 22:37:04 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
Database();
|
|
|
|
int version();
|
|
|
|
|
|
|
|
bool migrate();
|
|
|
|
bool migrateTo1();
|
2021-05-14 16:46:54 +02:00
|
|
|
bool migrateTo2();
|
2021-06-23 21:11:04 +02:00
|
|
|
bool migrateTo3();
|
2021-07-14 22:27:52 +02:00
|
|
|
bool migrateTo4();
|
2020-03-26 20:24:28 +01:00
|
|
|
void cleanup();
|
2020-03-16 22:37:04 +01:00
|
|
|
};
|