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.
26 lines
606 B
26 lines
606 B
#pragma once
|
|
|
|
#include <db/db.h>
|
|
#include <map>
|
|
#include <db/migrations/Migration.h>
|
|
|
|
namespace db {
|
|
class Schema {
|
|
public:
|
|
Schema(sql::Database* db);
|
|
uint32_t run_migrations();
|
|
|
|
private:
|
|
uint32_t get_user_version() const;
|
|
void set_user_version(uint32_t user_version);
|
|
void set_savepoint();
|
|
void rollback_migrations();
|
|
void commit_migrations();
|
|
void assemble_migrations();
|
|
|
|
sql::Database* m_db;
|
|
uint32_t m_user_version;
|
|
const std::string m_migration_savepoint = "migrations_savepoint";
|
|
std::map<uint32_t, db::migrations::Migration*> migrations;
|
|
};
|
|
}
|