Skip to content

Commit

Permalink
refactoring consumer primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
CriMDev97 committed Nov 2, 2023
1 parent c488496 commit 19f77a0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
25 changes: 13 additions & 12 deletions src/main/resources/db/changelog/changes/init_table/init_table.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS ESERVICE (
eservice_id VARCHAR (50) UNIQUE NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
producer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
Expand All @@ -15,21 +15,22 @@ CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_PRODUCER_ID ON ESERVICE USING hash (pr
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_DESCRIPTOR_ID ON ESERVICE USING hash (descriptor_id);



CREATE TABLE IF NOT EXISTS CONSUMER_ESERVICE (
eservice_id VARCHAR (50) NOT NULL,
consumer_id VARCHAR (50) NOT NULL,
agreement_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
UNIQUE (eservice_id, consumer_id, descriptor_id),
PRIMARY KEY (eservice_id, consumer_id, descriptor_id)
agreement_id VARCHAR (50) NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
consumer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
PRIMARY KEY (agreement_id)
);

CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_ID ON CONSUMER_ESERVICE USING hash (eservice_id);
CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_CONSUMER_ID ON CONSUMER_ESERVICE USING hash (consumer_id);
CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_DESCRIPTOR_ID ON CONSUMER_ESERVICE USING hash (descriptor_id);



CREATE TABLE IF NOT EXISTS SIGNAL (
Expand Down
26 changes: 13 additions & 13 deletions src/test/resources/schema-h2.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CREATE TABLE IF NOT EXISTS ESERVICE (
eservice_id VARCHAR (50) UNIQUE NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
producer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
Expand All @@ -17,21 +17,21 @@ CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_DESCRIPTOR_ID ON ESERVICE USING hash (


CREATE TABLE IF NOT EXISTS CONSUMER_ESERVICE (
eservice_id VARCHAR (50) NOT NULL,
consumer_id VARCHAR (50) NOT NULL,
agreement_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
UNIQUE (eservice_id, consumer_id, descriptor_id),
PRIMARY KEY (eservice_id, consumer_id, descriptor_id)
);
agreement_id VARCHAR (50) NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
consumer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
PRIMARY KEY (agreement_id)
);


/*
CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_ID ON CONSUMER_ESERVICE USING hash (eservice_id);
CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_CONSUMER_ID ON CONSUMER_ESERVICE USING hash (consumer_id);
CREATE INDEX IF NOT EXISTS CONSUMER_ESERVICE_INDEX_DESCRIPTOR_ID ON CONSUMER_ESERVICE USING hash (descriptor_id);
*/


Expand Down

0 comments on commit 19f77a0

Please sign in to comment.