Skip to content

Commit f440af9

Browse files
maciejwalkowiakodrotbohm
authored andcommitted
GH-403 - Add database indexes in schema files.
Original pull request: GH-411.
1 parent aa4b34c commit f440af9

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-h2.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
77
PUBLICATION_DATE TIMESTAMP(9) WITH TIME ZONE NOT NULL,
88
SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
99
PRIMARY KEY (ID)
10-
)
10+
);
11+
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_LISTENER_ID_SERIALIZED_EVENT_IDX ON EVENT_PUBLICATION (LISTENER_ID, SERIALIZED_EVENT);
12+
CREATE INDEX IF NOT EXISTS EVENT_PUBLICATION_COMPLETION_DATE_IDX ON EVENT_PUBLICATION (COMPLETION_DATE);

spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-mysql.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION
66
SERIALIZED_EVENT VARCHAR(4000) NOT NULL,
77
PUBLICATION_DATE TIMESTAMP(6) NOT NULL,
88
COMPLETION_DATE TIMESTAMP(6) DEFAULT NULL NULL,
9-
PRIMARY KEY (ID)
10-
)
9+
PRIMARY KEY (ID),
10+
INDEX EVENT_PUBLICATION_LISTENER_ID_IDX (LISTENER_ID),
11+
INDEX EVENT_PUBLICATION_COMPLETION_DATE_IDX (COMPLETION_DATE)
12+
);

spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ CREATE TABLE IF NOT EXISTS event_publication
77
publication_date TIMESTAMP WITH TIME ZONE NOT NULL,
88
completion_date TIMESTAMP WITH TIME ZONE,
99
PRIMARY KEY (id)
10-
)
10+
);
11+
CREATE INDEX IF NOT EXISTS event_publication_listener_id_serialized_event_idx ON event_publication (listener_id, serialized_event);
12+
CREATE INDEX IF NOT EXISTS event_publication_completion_date_idx ON event_publication (completion_date);

0 commit comments

Comments
 (0)