Skip to content
Closed
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
@@ -0,0 +1,17 @@
<?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="pirogigo" id="1756119288000-1">
<update tableName="voltage_init_result_entity_bus_voltages">
<column name="voltage_level_id"
valueComputed="regexp_replace(bus_id, '_[0-9]{1,2}$', '')" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is the right approach to retrieve the voltage level ID.
The proposed solution relies on string formatting, but the formatting rules may vary from one view to another (Bus_Breaker or Node_Breaker). Even if the rule is well defined, it's still possible to create a voltage level whose base name contains an underscore, which would break this approach.

Copy link
Author

@ipirog ipirog Aug 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the last occurence of _X(X) is deleted in the resulting voltage_level_id, a base name containing " _ " will be correctly updated : $ – The end of a line .

<where>voltage_level_id IS NULL</where>
</update>
</changeSet>
<changeSet author="pirogigo" id="1756119288000-2">
<update tableName="voltage_init_result_entity_reactive_slacks">
<column name="voltage_level_id"
valueComputed="regexp_replace(bus_id, '_[0-9]{1,2}$', '')" />
<where>voltage_level_id IS NULL</where>
</update>
</changeSet>
</databaseChangeLog>
3 changes: 3 additions & 0 deletions src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ databaseChangeLog:
- include:
file: changesets/changelog_20250801T132858Z.xml
relativeToChangelogFile: true
- include:
file: changesets/changelog_20250825T125400Z.xml
relativeToChangelogFile: true