openPilotLog
adatabasesetup.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2021 Felix Turowsky
4  *
5  *This program is free software: you can redistribute it and/or modify
6  *it under the terms of the GNU General Public License as published by
7  *the Free Software Foundation, either version 3 of the License, or
8  *(at your option) any later version.
9  *
10  *This program is distributed in the hope that it will be useful,
11  *but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *GNU General Public License for more details.
14  *
15  *You should have received a copy of the GNU General Public License
16  *along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 #ifndef DBSETUP_H
19 #define DBSETUP_H
20 
21 #include <QCoreApplication>
22 #include <QStringBuilder>
23 #include <QEventLoop>
24 
25 #define DATABASE_REVISION 17
26 
27 const auto TEMPLATE_URL = QStringLiteral("https://raw.githubusercontent.com/fiffty-50/openpilotlog/develop/assets/database/templates/");
28 
36 {
37 public:
38  static void debug();
39 
40  static bool createDatabase();
41 
42  static bool downloadTemplates();
43 
44  static bool backupOldData();
45 
46  static bool fillTemplates();
47 
48  static bool importDefaultData(bool use_local_data);
49 
50  static bool resetToDefault();
51 
52  static bool commitData(QVector<QStringList> from_csv, const QString &table_name);
53 
54 private:
55 
56  static bool createSchemata(const QStringList &statements);
57 
58 
59 };
60 
61 #endif // DBSETUP_H
ADataBaseSetup::commitData
static bool commitData(QVector< QStringList > from_csv, const QString &table_name)
DbSetup::commitData inserts the data parsed from a csv file into the database. The first line of the ...
Definition: adatabasesetup.cpp:452
ADataBaseSetup::resetToDefault
static bool resetToDefault()
DbSetup::resetToDefault Empties all user-generated content in the database.
Definition: adatabasesetup.cpp:379
ADataBaseSetup::debug
static void debug()
dbSetup::debug prints Database Layout
Definition: adatabasesetup.cpp:396
ADataBaseSetup
The ADataBaseSetup class is responsible for the inital setup of the database when the application is ...
Definition: adatabasesetup.h:36