Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql')
-rw-r--r--openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql106
1 files changed, 79 insertions, 27 deletions
diff --git a/openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql b/openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql
index d312ab34..c5ab0cda 100644
--- a/openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql
+++ b/openk-platform/openk-cachedb-service/src/main/resources/flyway-migration/V01/_00/OPENK_CACHEDB_V01_00_001__init.sql
@@ -27,12 +27,14 @@ INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('REDUCTION_SET
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('AC_LINE_SEGMENT_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('GEOGRAPHICAL_REGION_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('SUBGEOGRAPHICAL_REGION_SEQ', 1);
+INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('OPERATING_PARTICIPANT_SEQ', 1);
+INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('OPERATING_SHARE_SEQ', 1);
CREATE TABLE GEOGRAPHICAL_REGION
(
ID INTEGER NOT NULL,
MRID VARCHAR(16),
- NAME VARCHAR(64),
+ NAME VARCHAR(128),
CONSTRAINT "PK_GEOGRAPHICAL_REGION" PRIMARY KEY (ID)
)
WITH (OIDS =FALSE
@@ -42,8 +44,8 @@ ALTER TABLE GEOGRAPHICAL_REGION OWNER TO cachedb;
CREATE TABLE SUBGEOGRAPHICAL_REGION
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ MRID VARCHAR(16) UNIQUE,
+ NAME VARCHAR(128),
GEOGRAPHICAL_REGION_ID INTEGER,
CONSTRAINT "PK_SUBGEOGRAPHICAL_REGION" PRIMARY KEY (ID),
CONSTRAINT "FK_SUBGEOGRAPHICAL_REGION_GEOGRAPHICAL_REGION" FOREIGN KEY (GEOGRAPHICAL_REGION_ID) REFERENCES GEOGRAPHICAL_REGION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -54,9 +56,9 @@ ALTER TABLE SUBGEOGRAPHICAL_REGION OWNER TO cachedb;
CREATE TABLE EQUIPMENT_CONTAINER
(
- ID INTEGER NOT NULL,
- MRID VARCHAR(16) NOT NULL ,
- NAME VARCHAR(64),
+ ID INTEGER NOT NULL,
+ MRID VARCHAR(16) NOT NULL UNIQUE,
+ NAME VARCHAR(128),
HIGH_VOLTAGE_LIMIT_VALUE NUMERIC,
HIGH_VOLTAGE_LIMIT_UNIT_MULTIPLIER VARCHAR(12),
HIGH_VOLTAGE_LIMIT_UNIT_SYMBOL VARCHAR(12),
@@ -73,7 +75,7 @@ ALTER TABLE EQUIPMENT_CONTAINER OWNER TO cachedb;
CREATE TABLE LOCATION
(
ID INTEGER NOT NULL,
- NAME VARCHAR(64),
+ NAME VARCHAR(128),
STREET_NAME VARCHAR(64),
STREET_NUMBER VARCHAR(12),
POSTAL_CODE VARCHAR(12),
@@ -121,21 +123,22 @@ ALTER TABLE GENERATING_UNIT OWNER TO cachedb;
CREATE TABLE SYNCHRONOUS_MACHINE
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16) NOT NULL,
- NAME VARCHAR(64),
- NORMALLY_IN_SERVICE VARCHAR(5) NOT NULL,
+ MRID VARCHAR(16) NOT NULL UNIQUE,
+ NAME VARCHAR(128),
+ NORMALLY_IN_SERVICE VARCHAR(5) NOT NULL,
MAX_VOLTAGE_LIMIT_VALUE NUMERIC,
MAX_VOLTAGE_LIMIT_UNIT_MULTIPLIER VARCHAR(12),
MAX_VOLTAGE_LIMIT_UNIT_SYMBOL VARCHAR(12),
SYNCHRONOUS_MACHINE_KIND VARCHAR(32) NOT NULL,
CURRENT_REDUCTION_SETTING_PER_CENT INTEGER,
+ STATUS_CURRENT_REDUCTION_SETTING VARCHAR(5) NOT NULL,
FEED_IN_RANKING INTEGER,
FEED_IN_PRIORITY INTEGER,
COMMUNICATION_TYPE VARCHAR(12),
COMMUNICATION_GROUP INTEGER,
- CONTROL_ENABLED VARCHAR(5) NOT NULL,
+ CONTROL_ENABLED VARCHAR(5) NOT NULL,
SYNCHRONOUS_MACHINE_ID INTEGER,
- GENERATING_UNIT_ID INTEGER NOT NULL,
+ GENERATING_UNIT_ID INTEGER NOT NULL,
LOCATION_ID INTEGER,
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_SYNCHRONOUS_MACHINE_ID" PRIMARY KEY (ID),
@@ -163,7 +166,7 @@ ALTER TABLE REDUCTION_SETTING OWNER TO cachedb;
CREATE TABLE MEASUREMENT_ANALOG
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
+ MRID VARCHAR(16) UNIQUE,
MEASUREMENT_TYPE VARCHAR(16),
MEASUREMENT_UNIT_MULTIPLIER VARCHAR(12),
MEASUREMENT_UNIT_SYMBOL VARCHAR(12),
@@ -180,9 +183,10 @@ ALTER TABLE MEASUREMENT_ANALOG OWNER TO cachedb;
CREATE TABLE MEASUREMENT_ANALOG_VALUE
(
- ID INTEGER NOT NULL,
+ ID INTEGER NOT NULL,
TIMESTAMP_VALUE TIMESTAMP,
VALUE NUMERIC,
+ VALUE_QUALITY_FAILURE VARCHAR(5) NOT NULL,
MEASUREMENT_ANALOG_ID INTEGER,
CONSTRAINT "PK_MEASUREMENT_ANALOG_VALUE" PRIMARY KEY (ID),
CONSTRAINT "FK_MEASUREMENT_ANALOG_VALUE_MEASUREMENT_ANALOG" FOREIGN KEY (MEASUREMENT_ANALOG_ID) REFERENCES MEASUREMENT_ANALOG (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -194,7 +198,7 @@ ALTER TABLE MEASUREMENT_ANALOG_VALUE OWNER TO cachedb;
CREATE TABLE PSR_EVENT
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
+ MRID VARCHAR(16) UNIQUE,
PSR_EVENT_KIND VARCHAR(16),
TIMESTAMP_CREATED TIMESTAMP,
SYNCHRONOUS_MACHINE_ID INTEGER,
@@ -208,8 +212,8 @@ ALTER TABLE PSR_EVENT OWNER TO cachedb;
CREATE TABLE AC_LINE_SEGMENT
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ MRID VARCHAR(16) UNIQUE,
+ NAME VARCHAR(128),
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_ACL_LINE_SEGMENT" PRIMARY KEY (ID),
CONSTRAINT "FK_AC_LINE_SEGMENT_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -221,8 +225,8 @@ ALTER TABLE AC_LINE_SEGMENT OWNER TO cachedb;
CREATE TABLE POWER_TRANSFORMER
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ MRID VARCHAR(16) UNIQUE,
+ NAME VARCHAR(128),
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_POWER_TRANSFORMER" PRIMARY KEY (ID),
CONSTRAINT "FK_POWER_TRANSFORMER_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -234,8 +238,8 @@ ALTER TABLE POWER_TRANSFORMER OWNER TO cachedb;
CREATE TABLE SWITCH
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ MRID VARCHAR(16) UNIQUE,
+ NAME VARCHAR(128),
OPEN VARCHAR(5),
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_SWITCH" PRIMARY KEY (ID),
@@ -248,8 +252,8 @@ ALTER TABLE SWITCH OWNER TO cachedb;
CREATE TABLE BUSBAR_SECTION
(
ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ MRID VARCHAR(16) UNIQUE,
+ NAME VARCHAR(128),
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_BUSBAR_SECTION" PRIMARY KEY (ID),
CONSTRAINT "FK_BUSBAR_SECTION_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -258,11 +262,58 @@ WITH (OIDS =FALSE
);
ALTER TABLE BUSBAR_SECTION OWNER TO cachedb;
+
+CREATE TABLE OPERATING_PARTICIPANT
+(
+ ID INTEGER NOT NULL,
+ MRID VARCHAR(16) NOT NULL,
+ NAME VARCHAR(128),
+ SHARE_PER_CENT INTEGER,
+ POWER_TRANSFORMER_ID INTEGER,
+ BUSBAR_SECTION_ID INTEGER,
+ SWITCH_ID INTEGER,
+ SYNCHRONOUS_MACHINE_ID INTEGER,
+ AC_LINE_SEGMENT_ID INTEGER,
+ CONSTRAINT "PK_OPERATING_PARTICIPANT" PRIMARY KEY (ID),
+ CONSTRAINT "FK_OPERATING_PARTICIPIENT_POWER_TRANSFORMER" FOREIGN KEY (POWER_TRANSFORMER_ID) REFERENCES POWER_TRANSFORMER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT "FK_OPERATING_PARTICIPIENT_BUSBAR_SECTION" FOREIGN KEY (BUSBAR_SECTION_ID) REFERENCES BUSBAR_SECTION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT "FK_OPERATING_PARTICIPIENT_SWITCH" FOREIGN KEY (SWITCH_ID) REFERENCES SWITCH (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT "FK_OPERATING_PARTICIPIENT_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+ CONSTRAINT "FK_OPERATING_PARTICIPIENT_AC_LINE_SEGMENT" FOREIGN KEY (AC_LINE_SEGMENT_ID) REFERENCES AC_LINE_SEGMENT (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
+)
+WITH (OIDS =FALSE
+);
+ALTER TABLE OPERATING_PARTICIPANT OWNER TO cachedb;
+
+-- CREATE TABLE OPERATING_SHARE
+-- (
+-- ID INTEGER NOT NULL,
+-- SHARE_PER_CENT INTEGER,
+-- OPERATING_PARTICIPANT_MRID VARCHAR(16),
+ -- OPERATING_PARTICIPANT_ID INTEGER,
+-- POWER_TRANSFORMER_ID INTEGER,
+-- BUSBAR_SECTION_ID INTEGER,
+-- SWITCH_ID INTEGER,
+-- SYNCHRONOUS_MACHINE_ID INTEGER,
+-- AC_LINE_SEGMENT_ID INTEGER,
+-- CONSTRAINT "PK_OPERATING_SHARE" PRIMARY KEY (ID),
+-- CONSTRAINT "FK_OPERATING_SHARE_OPERATING_PARTICIPANT" FOREIGN KEY (OPERATING_PARTICIPANT_MRID) REFERENCES OPERATING_PARTICIPANT (MRID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- -- CONSTRAINT "FK_OPERATING_SHARE_OPERATING_PARTICIPANT" FOREIGN KEY (OPERATING_PARTICIPANT_ID) REFERENCES OPERATING_PARTICIPANT (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- CONSTRAINT "FK_OPERATING_SHARE_POWER_TRANSFORMER" FOREIGN KEY (POWER_TRANSFORMER_ID) REFERENCES POWER_TRANSFORMER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- CONSTRAINT "FK_OPERATING_SHARE_BUSBAR_SECTION" FOREIGN KEY (BUSBAR_SECTION_ID) REFERENCES BUSBAR_SECTION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- CONSTRAINT "FK_OPERATING_SHARE_SWITCH" FOREIGN KEY (SWITCH_ID) REFERENCES SWITCH (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- CONSTRAINT "FK_OPERATING_SHARE_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
+-- CONSTRAINT "FK_OPERATING_SHARE_AC_LINE_SEGMENT" FOREIGN KEY (AC_LINE_SEGMENT_ID) REFERENCES AC_LINE_SEGMENT (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
+-- )
+-- WITH (OIDS =FALSE
+-- );
+-- ALTER TABLE OPERATING_SHARE OWNER TO cachedb;
+
CREATE TABLE CONNECTIVITY_NODE
(
ID INTEGER NOT NULL,
MRID VARCHAR(16),
- NAME VARCHAR(64),
+ NAME VARCHAR(128),
EQUIPMENT_CONTAINER_ID INTEGER,
CONSTRAINT "PK_CONNECTIVITY_NODE" PRIMARY KEY (ID),
CONSTRAINT "FK_CONNECTIVITY_NODE_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
@@ -273,9 +324,10 @@ ALTER TABLE CONNECTIVITY_NODE OWNER TO cachedb;
CREATE TABLE TERMINAL
(
- ID INTEGER NOT NULL,
- MRID VARCHAR(16),
- NAME VARCHAR(64),
+ ID INTEGER NOT NULL,
+ MRID VARCHAR(16) NOT NULL,
+ NAME VARCHAR(128) NOT NULL,
+ CONNECTED VARCHAR(5) NOT NULL,
CONNECTIVITY_NODE_ID INTEGER,
POWER_TRANSFORMER_ID INTEGER,
BUSBAR_SECTION_ID INTEGER,

Back to the top