summaryrefslogtreecommitdiffstats
path: root/server/src/database/migrator.cppm
blob: d7fbfc3aff7935313602ee86ce638c423ded28f6 (about) (plain) (blame)
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
export module routemon:database.migrator;

import :database.sqlite3;
import :log;

namespace routemon::database {

export class migrator
{
  log::logger l_;
  sqlite3::connection dbc_;
  std::filesystem::path migrations_dir_;

  auto current_version() -> std::int64_t;

public:
  explicit migrator(
      log::logger const& l, std::filesystem::path const& db_filename,
      std::filesystem::path migrations_dir);

  auto migrate_to(std::int64_t target_version) -> void;
  auto migrate_step(std::int64_t target_version, util::zstring_view sql)
      -> void;
};

} // namespace routemon::database