-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
41 lines (29 loc) · 948 Bytes
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "helpers/seederhelper.h"
#include "mainwindow.h"
#include "helpers/databasehelper.h"
#include <QDir>
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
qDebug() << "Current working directory:" << QDir::currentPath();
DatabaseHelper& dbHelper = DatabaseHelper::getInstance();
if (!dbHelper.init()) {
qDebug() << "Failed to init database";
return -1;
}
// Run all migrations
for (const auto &migration : DatabaseHelper::migrations) {
if (!dbHelper.applyMigration(migration.name, migration.sql)) {
qDebug() << "Failed to apply migration:" << migration.name;
return -1;
}
}
// Run all seeders
SeederHelper seeder(dbHelper.getDatabaseInstance());
seeder.run();
MainWindow w(dbHelper.getDatabaseInstance());
w.setWindowTitle("OpenFoam Cloud Laborer");
w.show();
return a.exec();
}