forked from Onlineberatung/onlineBeratung-migrationTool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from virtualidentityag/release-2024-03-20
release 2024-03-20
- Loading branch information
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...rationtool/mongodb/UpdateLegalContentChangesBySingleTenantAdminsAllowedMigrationTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...nt_admin_allowed/0026_deactivate_legal_content_changes_by_single_tenant_admin_allowed.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters