|
@ -1,12 +1,17 @@ |
|
|
#pragma once |
|
|
#pragma once |
|
|
|
|
|
|
|
|
#include <db/db.h> |
|
|
#include <db/db.h> |
|
|
|
|
|
#include <db/Schema.h> |
|
|
#include <string> |
|
|
#include <string> |
|
|
|
|
|
|
|
|
namespace db { |
|
|
namespace db { |
|
|
sql::Database init(std::string name) { |
|
|
|
|
|
sql::Database db(name, SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); |
|
|
|
|
|
DEBUG << "SQLite database file '" << db.getFilename().c_str() << "' opened successfully\n"; |
|
|
|
|
|
|
|
|
sql::Database* init(std::string name) { |
|
|
|
|
|
sql::Database* db = new sql::Database(name, SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE); |
|
|
|
|
|
DEBUG << "SQLite database file '" << db->getFilename().c_str() << "' opened successfully\n"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Schema* schema = new Schema(db); |
|
|
|
|
|
schema->run_migrations(); |
|
|
return db; |
|
|
return db; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |