From 486f7e0c8602c66dbbc33fd0fd825582e166a83d Mon Sep 17 00:00:00 2001 From: Oliver Drotbohm Date: Fri, 2 Dec 2022 17:33:04 +0100 Subject: [PATCH] GH-81 - Change Postgres event publication schema to follow best practices. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * No uppercase table and column names [0] * Don't use varchar(n) by default [1] * Don't use timestamp(…) or timestamptz(…) [0] https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don't_use_upper_case_table_or_column_names [1] https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don't_use_varchar(n)_by_default [2] https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don't_use_timestamp(0)_or_timestamptz(0) --- .../src/main/resources/schema-postgresql.sql | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql b/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql index afc7cc07..bd8bd6d7 100644 --- a/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql +++ b/spring-modulith-events/spring-modulith-events-jdbc/src/main/resources/schema-postgresql.sql @@ -1,10 +1,10 @@ -CREATE TABLE IF NOT EXISTS EVENT_PUBLICATION +CREATE TABLE IF NOT EXISTS event_publication ( - ID UUID NOT NULL, - LISTENER_ID VARCHAR(512) NOT NULL, - EVENT_TYPE VARCHAR(512) NOT NULL, - SERIALIZED_EVENT VARCHAR(4000) NOT NULL, - PUBLICATION_DATE TIMESTAMP(9) WITH TIME ZONE NOT NULL, - COMPLETION_DATE TIMESTAMP(9) WITH TIME ZONE, - PRIMARY KEY (ID) + id UUID NOT NULL, + listener_id TEXT NOT NULL, + event_type TEXT NOT NULL, + serialized_event TEXT NOT NULL, + publication_date TIMESTAMP WITH TIME ZONE NOT NULL, + completion_date TIMESTAMP WITH TIME ZONE, + PRIMARY KEY (id) )