Skip to content

Commit

Permalink
bug(#2165): Fix migration for adapter instances (#2167)
Browse files Browse the repository at this point in the history
  • Loading branch information
tenthe authored Nov 13, 2023
1 parent 1306e79 commit 18cdb2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public void executeMigration() {
LOG.info("Performing backup of old models to database adapterinstance_backup");

adaptersToMigrate.forEach(adapter -> {
new AdapterBackupWriter(adapterInstanceBackupClient, new MigrationHelpers()).writeBackup(adapter);
// Is required to keep the _rev field for the original object. This field must be removed for the backup
var copyAdapter = adapter.deepCopy();
new AdapterBackupWriter(adapterInstanceBackupClient, new MigrationHelpers()).writeBackup(copyAdapter);
});

LOG.info("Performing migration of adapters");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public void migrate(CouchDbClient couchDbClient,
var adapterName = helpers.getAdapterName(adapter);
var convertedAdapter = converter.convert(adapter);

LOG.info("Start migrating adapter {}", adapterName);

couchDbClient.update(convertedAdapter);

LOG.info("Successfully migrated adapter {}", adapterName);
Expand Down

0 comments on commit 18cdb2d

Please sign in to comment.