Skip to content

Commit

Permalink
Updated init_table.sql and schema-h2.sql scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
pasqualino.cristaudo committed Nov 6, 2023
1 parent 19f77a0 commit 757427c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 50 deletions.
46 changes: 22 additions & 24 deletions src/main/resources/db/changelog/changes/init_table/init_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,36 @@ CREATE TABLE IF NOT EXISTS ESERVICE (
eservice_id VARCHAR (50) NOT NULL,
producer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
event_id BIGINT,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
UNIQUE (eservice_id, producer_id, descriptor_id),
PRIMARY KEY (eservice_id, producer_id, descriptor_id)
UNIQUE (eservice_id, producer_id),
PRIMARY KEY (eservice_id, producer_id)
);

CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_ID ON ESERVICE USING hash (eservice_id);
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_PRODUCER_ID ON ESERVICE USING hash (producer_id);
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_DESCRIPTOR_ID ON ESERVICE USING hash (descriptor_id);



CREATE TABLE IF NOT EXISTS CONSUMER_ESERVICE (
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)
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,
UNIQUE (eservice_id, consumer_id, descriptor_id),
PRIMARY KEY (eservice_id, consumer_id, descriptor_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 (
id SERIAL PRIMARY KEY,
id SERIAL PRIMARY KEY,
correlation_id VARCHAR(50) NOT NULL,
signal_id BIGINT NOT NULL,
object_id VARCHAR (50) NOT NULL,
Expand All @@ -49,7 +46,7 @@ CREATE INDEX IF NOT EXISTS SIGNAL_INDEX_ESERVICE_ID ON SIGNAL USING hash (eservi


CREATE TABLE IF NOT EXISTS DEAD_SIGNAL (
id SERIAL PRIMARY KEY,
id SERIAL PRIMARY KEY,
correlation_id VARCHAR(50) NOT NULL,
signal_id BIGINT NOT NULL,
object_id VARCHAR (50) NOT NULL,
Expand All @@ -62,13 +59,14 @@ CREATE TABLE IF NOT EXISTS DEAD_SIGNAL (


CREATE TABLE IF NOT EXISTS TRACING_BATCH (
batch_id SERIAL PRIMARY KEY,
state VARCHAR (50) NOT NULL,
last_event_id BIGINT,
tmst_started TIMESTAMP NOT NULL,
tmst_ended TIMESTAMP
batch_id SERIAL PRIMARY KEY,
state VARCHAR (50) NOT NULL,
last_event_id BIGINT,
tmst_started TIMESTAMP NOT NULL,
tmst_ended TIMESTAMP
);


CREATE TABLE IF NOT EXISTS DEAD_EVENT (
event_tmp_id SERIAL PRIMARY KEY,
tmst_insert TIMESTAMP,
Expand Down
52 changes: 26 additions & 26 deletions src/test/resources/schema-h2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,41 @@ CREATE TABLE IF NOT EXISTS ESERVICE (
eservice_id VARCHAR (50) NOT NULL,
producer_id VARCHAR (50) NOT NULL,
descriptor_id VARCHAR (50) NOT NULL,
event_id BIGINT ,
event_id BIGINT,
state VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
tmst_last_edit TIMESTAMP,
UNIQUE (eservice_id, producer_id, descriptor_id),
PRIMARY KEY (eservice_id, producer_id, descriptor_id)
UNIQUE (eservice_id, producer_id),
PRIMARY KEY (eservice_id, producer_id)
);
/*
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_ID ON ESERVICE USING hash (eservice_id);
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_PRODUCER_ID ON ESERVICE USING hash (producer_id);
CREATE INDEX IF NOT EXISTS ESERVICE_INDEX_DESCRIPTOR_ID ON ESERVICE USING hash (descriptor_id);
*/


CREATE TABLE IF NOT EXISTS CONSUMER_ESERVICE (
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 TABLE IF NOT EXISTS CONSUMER_ESERVICE (
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,
UNIQUE (eservice_id, consumer_id, descriptor_id),
PRIMARY KEY (eservice_id, consumer_id, descriptor_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 (
id SERIAL PRIMARY KEY,
id SERIAL PRIMARY KEY,
correlation_id VARCHAR(50) NOT NULL,
signal_id BIGINT NOT NULL,
object_id VARCHAR (50) NOT NULL,
Expand All @@ -53,15 +53,15 @@ CREATE INDEX IF NOT EXISTS SIGNAL_INDEX_ESERVICE_ID ON SIGNAL USING hash (eservi


CREATE TABLE IF NOT EXISTS DEAD_SIGNAL (
id SERIAL PRIMARY KEY,
correlation_id VARCHAR(50) NOT NULL,
signal_id BIGINT NOT NULL,
object_id VARCHAR (50) NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
object_type VARCHAR (50) NOT NULL,
signal_type VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP NOT NULL,
error_reason VARCHAR(255) NOT NULL
id SERIAL PRIMARY KEY,
correlation_id VARCHAR(50) NOT NULL,
signal_id BIGINT NOT NULL,
object_id VARCHAR (50) NOT NULL,
eservice_id VARCHAR (50) NOT NULL,
object_type VARCHAR (50) NOT NULL,
signal_type VARCHAR (50) NOT NULL,
tmst_insert TIMESTAMP NOT NULL,
error_reason VARCHAR(255) NOT NULL
);


Expand Down

0 comments on commit 757427c

Please sign in to comment.