-
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 branch 'main' into battery_tabular_modifications
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/main/resources/db/changelog/changesets/changelog_20231215T170225Z.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:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:pro="http://www.liquibase.org/xml/ns/pro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd"> | ||
<changeSet author="boutiercha" id="migrationMetadataFixNullValues-20231215-1"> | ||
<sqlFile | ||
encoding="UTF-8" | ||
path="migrationMetadataFixNullValues_20231215T170225Z.sql" | ||
relativeToChangelogFile="true" | ||
splitStatements="true" | ||
stripComments="true"/> | ||
</changeSet> | ||
</databaseChangeLog> |
20 changes: 20 additions & 0 deletions
20
...ain/resources/db/changelog/changesets/migrationMetadataFixNullValues_20231215T170225Z.sql
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,20 @@ | ||
-- REMOVE USELESS DATA FROM TABLE BRANCH_STATUS_MODIFICATION | ||
UPDATE branch_status_modification | ||
SET energized_voltage_level_id = NULL | ||
WHERE ( action = 'TRIP' OR action = 'LOCKOUT' OR action = 'SWITCH_ON' ) | ||
AND energized_voltage_level_id IS NOT NULL; | ||
-- RECREATE MESSAGE_VALUES IN TABLE MODIFICATION | ||
UPDATE modification m1 | ||
SET message_values = ( | ||
SELECT | ||
CASE | ||
WHEN bsm.energized_voltage_level_id IS NULL AND bsm.action IS NOT NULL AND bsm.equipment_id IS NOT NULL | ||
THEN '{"action":"' || bsm.action || '","equipmentId":"' || bsm.equipment_id || '"}' | ||
WHEN bsm.energized_voltage_level_id IS NOT NULL AND bsm.action IS NOT NULL AND bsm.equipment_id IS NOT NULL | ||
THEN '{"energizedVoltageLevelId":"' || bsm.energized_voltage_level_id || '","action":"' || bsm.action || '","equipmentId":"' || bsm.equipment_id || '"}' | ||
ELSE m1.message_values | ||
END | ||
FROM modification m | ||
LEFT JOIN branch_status_modification bsm ON m.id = bsm.id | ||
WHERE m1.id = m.id) | ||
WHERE m1.type = 'BRANCH_STATUS_MODIFICATION'; |
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