|
|
@@ -189,6 +189,22 @@ int runV1MigrationIfNeeded(const std::filesystem::path& dataDir,
|
|
|
bool forceMigrate, bool noAutoMigrate) {
|
|
|
using namespace smartbotic::db::storage;
|
|
|
|
|
|
+ // Already on the v2.3 multi-project layout? Then this instance is well past
|
|
|
+ // any v1.x → v2.0 migration. Skip the check entirely — crucially without
|
|
|
+ // create_directories(<dataDir>/env), which would re-create the legacy env
|
|
|
+ // dir on every boot and trip the v2.3 ambiguous-layout guard in
|
|
|
+ // migrateLegacyEnvToDefaultProject() (it refuses to start when both
|
|
|
+ // <dataDir>/env and <dataDir>/projects/default/env exist). That made any
|
|
|
+ // restart of a migrated instance fatal.
|
|
|
+ {
|
|
|
+ std::error_code ec23;
|
|
|
+ if (std::filesystem::exists(dataDir / "projects" / "default" / "env", ec23)) {
|
|
|
+ spdlog::info("v2.0 migration: v2.3 layout present (projects/default/env) — "
|
|
|
+ "skipping v1 check (not creating legacy env/)");
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// v2.0 env lives at <dataDir>/env/ — separate from v1.x's snapshots/
|
|
|
// and wal/. Open via the Stage 1 RAII wrapper.
|
|
|
LmdbEnvOpts envOpts;
|