Skip to content

Commit

Permalink
Merge pull request #26 from virtualidentityag/release-2024-03-20
Browse files Browse the repository at this point in the history
release 2024-03-20
  • Loading branch information
web-mi authored Mar 20, 2024
2 parents e6be7ee + b09a929 commit 6158bd4
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package com.vi.migrationtool.mongodb;

import com.vi.migrationtool.common.MigrationTasks;
import com.vi.migrationtool.config.BeanAwareSpringLiquibase;
import com.vi.migrationtool.mongodb.model.ApplicationSettingsEntity;
import com.vi.migrationtool.mongodb.service.ApplicationSettingService;
import com.vi.migrationtool.schemas.model.LegalContentChangesBySingleTenantAdminsAllowed;
import liquibase.database.Database;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;

@Data
@Slf4j
public class UpdateLegalContentChangesBySingleTenantAdminsAllowedMigrationTask
extends MigrationTasks {

private Boolean value;

@Override
public void execute(Database database) {
ApplicationSettingService applicationSettingService =
BeanAwareSpringLiquibase.getBean(ApplicationSettingService.class);
migrate(applicationSettingService);
}

public void migrate(ApplicationSettingService applicationSettingService) {
ApplicationSettingsEntity applicationSettingsEntity =
applicationSettingService.getApplicationSetting();
applyMigration(applicationSettingService, applicationSettingsEntity);
}

private void applyMigration(
ApplicationSettingService applicationSettingService,
ApplicationSettingsEntity applicationSettingsEntity) {
LegalContentChangesBySingleTenantAdminsAllowed toggle =
new LegalContentChangesBySingleTenantAdminsAllowed();
toggle.setValue(value);
applicationSettingsEntity.setLegalContentChangesBySingleTenantAdminsAllowed(toggle);
applicationSettingService.updateApplicationSettings(applicationSettingsEntity);
log.info(
"Applied migration to update legalContentChangesBySingleTenantAdminsAllowedMigrationTask with settings: value {}",
value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">

<changeSet author="tkuzynow" id="deactivate_legal_content_changes_by_single_tenant_admin_allowed">
<customChange class="com.vi.migrationtool.mongodb.UpdateLegalContentChangesBySingleTenantAdminsAllowedMigrationTask">
<param name="value" value='false'/>
</customChange>
</changeSet>
</databaseChangeLog>
4 changes: 2 additions & 2 deletions src/main/resources/migrations/master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
<!-- by default migration 0024_create_weblate_project is not applied. This must be decided by each of the clients and activated if needed -->
<!-- by default migration 0025_fix_rocketchat_user_id_inconsistency is not applied. This must be decided by each of the clients and activated if needed -->


</databaseChangeLog>
<!-- by default migration 0026_deactivate_legal_content_changes_by_single_tenant_admin_allowed is not applied. This must be decided by each of the clients and activated if needed -->
</databaseChangeLog>

0 comments on commit 6158bd4

Please sign in to comment.