You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
454 B

  1. #pragma once
  2. #include <db/db.h>
  3. #include <db/Schema.h>
  4. #include <string>
  5. namespace db {
  6. sql::Database* init(std::string name) {
  7. sql::Database* db = new sql::Database(name, SQLite::OPEN_READWRITE|SQLite::OPEN_CREATE);
  8. db->exec("PRAGMA foreign_keys = ON;");
  9. DEBUG << "SQLite database file '" << db->getFilename().c_str() << "' opened successfully\n";
  10. Schema* schema = new Schema(db);
  11. schema->run_migrations();
  12. return db;
  13. }
  14. }