Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions engine/migrations/migration_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cpp::result<bool, std::string> MigrationHelper::BackupDatabase(
try {
SQLite::Database src_db(src_db_path, SQLite::OPEN_READONLY);
sqlite3* backup_db;

if (sqlite3_open16(backup_db_path.c_str(), &backup_db) != SQLITE_OK) {
if (sqlite3_open(backup_db_path.c_str(), &backup_db) != SQLITE_OK) {
throw std::runtime_error("Failed to open backup database");
}

Expand Down
9 changes: 8 additions & 1 deletion engine/migrations/migration_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "schema_version.h"
#include "utils/file_manager_utils.h"
#include "utils/scope_exit.h"
#include "utils/widechar_conv.h"

namespace cortex::migr {

Expand Down Expand Up @@ -40,7 +41,13 @@ cpp::result<bool, std::string> MigrationManager::Migrate() {
if (std::filesystem::exists(fmu::GetCortexDataPath() / kCortexDb)) {
auto src_db_path = (fmu::GetCortexDataPath() / kCortexDb);
auto backup_db_path = (fmu::GetCortexDataPath() / kCortexDbBackup);
if (auto res = mgr_helper_.BackupDatabase(src_db_path, backup_db_path.string());
#if defined(_WIN32)
if (auto res = mgr_helper_.BackupDatabase(
src_db_path, cortex::wc::WstringToUtf8(backup_db_path.wstring()));
#else
if (auto res =
mgr_helper_.BackupDatabase(src_db_path, backup_db_path.string());
#endif
res.has_error()) {
CTL_INF("Error: backup database failed!");
return res;
Expand Down