From 50e7ecd4f9bbd3e1aba79c8f8db1e4fc9f3cb481 Mon Sep 17 00:00:00 2001 From: Etienne LESOT Date: Thu, 12 Sep 2024 08:22:28 +0200 Subject: [PATCH] change type of equipment_type in identifier_list_filter to varchar Signed-off-by: Etienne LESOT --- .../changesets/changelog_20240911T162600Z.xml | 23 +++++++++++++++++++ ...istFilterTypeRollBack_20240911T120841Z.sql | 19 +++++++++++++++ ...grationListFilterType_20240911T120841Z.sql | 19 +++++++++++++++ .../db/changelog/db.changelog-master.yaml | 3 +++ 4 files changed, 64 insertions(+) create mode 100644 src/main/resources/db/changelog/changesets/changelog_20240911T162600Z.xml create mode 100644 src/main/resources/db/changelog/changesets/migrationListFilterTypeRollBack_20240911T120841Z.sql create mode 100644 src/main/resources/db/changelog/changesets/migrationListFilterType_20240911T120841Z.sql diff --git a/src/main/resources/db/changelog/changesets/changelog_20240911T162600Z.xml b/src/main/resources/db/changelog/changesets/changelog_20240911T162600Z.xml new file mode 100644 index 00000000..5470aac8 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/changelog_20240911T162600Z.xml @@ -0,0 +1,23 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog/changesets/migrationListFilterTypeRollBack_20240911T120841Z.sql b/src/main/resources/db/changelog/changesets/migrationListFilterTypeRollBack_20240911T120841Z.sql new file mode 100644 index 00000000..53ec8821 --- /dev/null +++ b/src/main/resources/db/changelog/changesets/migrationListFilterTypeRollBack_20240911T120841Z.sql @@ -0,0 +1,19 @@ +ALTER TABLE identifier_list_filter ADD COLUMN equipment_type_temporary integer; +UPDATE identifier_list_filter SET equipment_type_temporary = 0 WHERE equipment_type ='LINE'; +UPDATE identifier_list_filter SET equipment_type_temporary = 1 WHERE equipment_type ='GENERATOR'; +UPDATE identifier_list_filter SET equipment_type_temporary = 2 WHERE equipment_type ='LOAD'; +UPDATE identifier_list_filter SET equipment_type_temporary = 3 WHERE equipment_type ='SHUNT_COMPENSATOR'; +UPDATE identifier_list_filter SET equipment_type_temporary = 4 WHERE equipment_type ='STATIC_VAR_COMPENSATOR'; +UPDATE identifier_list_filter SET equipment_type_temporary = 5 WHERE equipment_type ='BATTERY'; +UPDATE identifier_list_filter SET equipment_type_temporary = 6 WHERE equipment_type ='BUS'; +UPDATE identifier_list_filter SET equipment_type_temporary = 7 WHERE equipment_type ='BUSBAR_SECTION'; +UPDATE identifier_list_filter SET equipment_type_temporary = 8 WHERE equipment_type ='DANGLING_LINE'; +UPDATE identifier_list_filter SET equipment_type_temporary = 9 WHERE equipment_type ='LCC_CONVERTER_STATION'; +UPDATE identifier_list_filter SET equipment_type_temporary = 10 WHERE equipment_type = 'VSC_CONVERTER_STATION'; +UPDATE identifier_list_filter SET equipment_type_temporary = 11 WHERE equipment_type = 'TWO_WINDINGS_TRANSFORMER'; +UPDATE identifier_list_filter SET equipment_type_temporary = 12 WHERE equipment_type = 'THREE_WINDINGS_TRANSFORMER'; +UPDATE identifier_list_filter SET equipment_type_temporary = 13 WHERE equipment_type = 'HVDC_LINE'; +UPDATE identifier_list_filter SET equipment_type_temporary = 14 WHERE equipment_type = 'SUBSTATION'; +UPDATE identifier_list_filter SET equipment_type_temporary = 15 WHERE equipment_type = 'VOLTAGE_LEVEL'; +ALTER TABLE identifier_list_filter DROP COLUMN equipment_type; +ALTER TABLE identifier_list_filter RENAME COLUMN equipment_type_temporary TO equipment_type; \ No newline at end of file diff --git a/src/main/resources/db/changelog/changesets/migrationListFilterType_20240911T120841Z.sql b/src/main/resources/db/changelog/changesets/migrationListFilterType_20240911T120841Z.sql new file mode 100644 index 00000000..b42c5dac --- /dev/null +++ b/src/main/resources/db/changelog/changesets/migrationListFilterType_20240911T120841Z.sql @@ -0,0 +1,19 @@ +ALTER TABLE identifier_list_filter ADD COLUMN equipment_type_temporary varchar; +UPDATE identifier_list_filter SET equipment_type_temporary = 'LINE' WHERE equipment_type = 0; +UPDATE identifier_list_filter SET equipment_type_temporary = 'GENERATOR' WHERE equipment_type = 1; +UPDATE identifier_list_filter SET equipment_type_temporary = 'LOAD' WHERE equipment_type = 2; +UPDATE identifier_list_filter SET equipment_type_temporary = 'SHUNT_COMPENSATOR' WHERE equipment_type = 3; +UPDATE identifier_list_filter SET equipment_type_temporary = 'STATIC_VAR_COMPENSATOR' WHERE equipment_type = 4; +UPDATE identifier_list_filter SET equipment_type_temporary = 'BATTERY' WHERE equipment_type = 5; +UPDATE identifier_list_filter SET equipment_type_temporary = 'BUS' WHERE equipment_type = 6; +UPDATE identifier_list_filter SET equipment_type_temporary = 'BUSBAR_SECTION' WHERE equipment_type = 7; +UPDATE identifier_list_filter SET equipment_type_temporary = 'DANGLING_LINE' WHERE equipment_type = 8; +UPDATE identifier_list_filter SET equipment_type_temporary = 'LCC_CONVERTER_STATION' WHERE equipment_type = 9; +UPDATE identifier_list_filter SET equipment_type_temporary = 'VSC_CONVERTER_STATION' WHERE equipment_type = 10; +UPDATE identifier_list_filter SET equipment_type_temporary = 'TWO_WINDINGS_TRANSFORMER' WHERE equipment_type = 11; +UPDATE identifier_list_filter SET equipment_type_temporary = 'THREE_WINDINGS_TRANSFORMER' WHERE equipment_type = 12; +UPDATE identifier_list_filter SET equipment_type_temporary = 'HVDC_LINE' WHERE equipment_type = 13; +UPDATE identifier_list_filter SET equipment_type_temporary = 'SUBSTATION' WHERE equipment_type = 14; +UPDATE identifier_list_filter SET equipment_type_temporary = 'VOLTAGE_LEVEL' WHERE equipment_type = 15; +ALTER TABLE identifier_list_filter DROP COLUMN equipment_type; +ALTER TABLE identifier_list_filter RENAME COLUMN equipment_type_temporary TO equipment_type; \ No newline at end of file diff --git a/src/main/resources/db/changelog/db.changelog-master.yaml b/src/main/resources/db/changelog/db.changelog-master.yaml index 325cdfaa..3ee9b0f9 100644 --- a/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/src/main/resources/db/changelog/db.changelog-master.yaml @@ -49,3 +49,6 @@ databaseChangeLog: - include: file: changesets/changelog_20240902T233408Z.xml relativeToChangelogFile: true + - include: + file: changesets/changelog_20240911T162600Z.xml + relativeToChangelogFile: true