47 struct FileInformation
49 std::string m_schemaName;
51 std::filesystem::path m_filePath;
54 std::filesystem::path m_configPath = std::filesystem::path(CONFIG_DIRECTORY) /
"database";
55 std::shared_ptr<DatabaseConnectionConfigurations> m_connectionConfigurations;
57 static constexpr std::string_view m_createSchemaVersion =
58 R
"(CREATE TABLE schema_version (name TEXT NOT NULL PRIMARY KEY,version BIGINT NOT NULL);)";
60 static std::optional<db::Result> hasSchemaVersionTable(
61 const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry);
63 static void createSchemaVersionTable(
const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry);
65 static void initDatabase(
const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry,
66 const std::map<std::string, std::vector<FileInformation>> &initFiles,
67 const std::map<std::string, int32_t> &schemaVersions);
70 const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry,
71 const std::string &schemaName,
72 int32_t schemaVersion,
76 const FileInformation &item,
77 const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry,
78 int32_t ¤tSchemaVersion);
80 static std::string schemaNameOf(
const std::string &fileName);
82 static int32_t versionOf(
const std::string &fileName);
93 static void registerReadinessCheck(
const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry);
102 static void registerConnectionPool(
const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry);
104 void handle(
const std::shared_ptr<DatabaseConnectionEntry> &connectionEntry);