From ea4910a937f2e9310ad328bc47237662f8bcbd2c Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 15 Dec 2022 15:43:41 +0300 Subject: postgres: pass tests without implicit string types casts --- src/test/java/com/juick/server/tests/ServerTests.java | 2 +- src/test/resources/application-postgres.yml | 2 +- .../resources/db/specific/postgresql/V1.00__schema.sql | 16 ++-------------- 3 files changed, 4 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index d964185d..224743a7 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2333,7 +2333,7 @@ public class ServerTests { public void verifiedUsersTest() { assertThat(userService.getUserByName("ugnich").isVerified(), is(false)); jdbcTemplate.update("INSERT INTO telegram(user_id, tg_id, tg_name) VALUES(?, ?, ?)", ugnich.getUid(), - "100001866137681", "tg_test"); + 100001866137681L, "tg_test"); assertThat(userService.canDeleteTelegramUser(userService.getUserByName("ugnich")), is(false)); userService.addFacebookState("12345", "http://localhost"); userService.createFacebookUser(12345, "12345", "5678", "ugnich"); diff --git a/src/test/resources/application-postgres.yml b/src/test/resources/application-postgres.yml index b75b1e50..ed7249b3 100644 --- a/src/test/resources/application-postgres.yml +++ b/src/test/resources/application-postgres.yml @@ -1,6 +1,6 @@ spring: datasource: - url: jdbc:postgresql://localhost:5432/juick?stringtype=unspecified + url: jdbc:postgresql://localhost:5432/juick username: juick password: secret flyway: diff --git a/src/test/resources/db/specific/postgresql/V1.00__schema.sql b/src/test/resources/db/specific/postgresql/V1.00__schema.sql index 4909000a..f400ddfa 100644 --- a/src/test/resources/db/specific/postgresql/V1.00__schema.sql +++ b/src/test/resources/db/specific/postgresql/V1.00__schema.sql @@ -36,6 +36,7 @@ CREATE TYPE messages_attach AS ENUM ( 'png' ); +CREATE CAST (character varying AS messages_attach) WITH INOUT AS ASSIGNMENT; ALTER TYPE messages_attach OWNER TO juick; @@ -54,19 +55,6 @@ CREATE TYPE messages_lang AS ENUM ( ALTER TYPE messages_lang OWNER TO juick; --- --- Name: replies_attach; Type: TYPE; Schema: public; Owner: juick --- - -CREATE TYPE replies_attach AS ENUM ( - 'jpg', - 'mp4', - 'png' -); - - -ALTER TYPE replies_attach OWNER TO juick; - -- -- Name: users_lang; Type: TYPE; Schema: public; Owner: juick -- @@ -640,7 +628,7 @@ CREATE TABLE replies ( user_id bigint NOT NULL, replyto smallint DEFAULT 0::smallint NOT NULL, ts timestamp with time zone DEFAULT now() NOT NULL, - attach replies_attach, + attach messages_attach, txt text NOT NULL ); -- cgit v1.2.3