Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(#2165): Fix migration for adapter instances #2167

Merged
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
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