Skip to content

Commit

Permalink
Merge pull request #1752 from janhq/dev
Browse files Browse the repository at this point in the history
Sync dev to main 1.0.4-rc4
  • Loading branch information
hiento09 authored Nov 29, 2024
2 parents 287123e + 104ed76 commit 8749fa0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
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

0 comments on commit 8749fa0

Please sign in to comment.