diff --git a/console-app-example/src/main/java/io/github/mfvanek/postgres/example/PostgresClusterDemo.java b/console-app-example/src/main/java/io/github/mfvanek/postgres/example/PostgresClusterDemo.java index 6d4d556..932a1b6 100644 --- a/console-app-example/src/main/java/io/github/mfvanek/postgres/example/PostgresClusterDemo.java +++ b/console-app-example/src/main/java/io/github/mfvanek/postgres/example/PostgresClusterDemo.java @@ -21,7 +21,7 @@ public static void main(String[] args) throws InterruptedException { .withUsername("test_user") .withPassword("test_password") .withDatabaseName("test_db") - .withPostgresVersion("17.4") + .withPostgresVersion("17.6.0") .build()) { final var pgUrl = clusterWrapper.getCommonUrlToPrimary(); log.info("pgUrl = {}", pgUrl); diff --git a/console-app-example/src/test/java/io/github/mfvanek/postgres/example/SimpleTest.java b/console-app-example/src/test/java/io/github/mfvanek/postgres/example/SimpleTest.java index 2613266..5dec7cd 100644 --- a/console-app-example/src/test/java/io/github/mfvanek/postgres/example/SimpleTest.java +++ b/console-app-example/src/test/java/io/github/mfvanek/postgres/example/SimpleTest.java @@ -22,7 +22,7 @@ class SimpleTest { @Test void testSimple() throws SQLException { try (PostgreSQLContainer postgres = new PostgreSQLContainer<>( - DockerImageName.parse("postgres").withTag("17.4")) + DockerImageName.parse("postgres").withTag("17.6")) .withTmpFs(Collections.singletonMap("/var/lib/postgresql/data", "rw")) .withDatabaseName("test_db") .withUsername("test_user") diff --git a/db-commons/src/test/java/io/github/mfvanek/postgres/hikari/HikariDataSourceProviderTest.java b/db-commons/src/test/java/io/github/mfvanek/postgres/hikari/HikariDataSourceProviderTest.java index 151df19..94bc938 100644 --- a/db-commons/src/test/java/io/github/mfvanek/postgres/hikari/HikariDataSourceProviderTest.java +++ b/db-commons/src/test/java/io/github/mfvanek/postgres/hikari/HikariDataSourceProviderTest.java @@ -17,7 +17,7 @@ class HikariDataSourceProviderTest { @Test void getDataSourceShouldSetDriverClassName() { try (PostgreSQLContainer postgres = new PostgreSQLContainer<>( - DockerImageName.parse("postgres").withTag("17.4")) + DockerImageName.parse("postgres").withTag("17.6")) .withTmpFs(Collections.singletonMap("/var/lib/postgresql/data", "rw")) .withDatabaseName("test_db") .withUsername("test_user") diff --git a/internal-bom/build.gradle.kts b/internal-bom/build.gradle.kts index 0a28660..34a8b97 100644 --- a/internal-bom/build.gradle.kts +++ b/internal-bom/build.gradle.kts @@ -12,7 +12,7 @@ javaPlatform { dependencies { api(platform("org.junit:junit-bom:5.13.4")) api(platform("org.testcontainers:testcontainers-bom:1.21.3")) - api(platform("io.github.mfvanek:pg-index-health-bom:0.20.2")) + api(platform("io.github.mfvanek:pg-index-health-bom:0.30.0")) api(platform("org.mockito:mockito-bom:5.20.0")) api(platform("org.assertj:assertj-bom:3.27.6")) diff --git a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/config/DatabaseConfig.java b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/config/DatabaseConfig.java index ed3bd00..579dc73 100644 --- a/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/config/DatabaseConfig.java +++ b/spring-boot-app-example/src/main/java/io/github/mfvanek/pg/cluster/config/DatabaseConfig.java @@ -24,7 +24,7 @@ public PostgreSqlClusterWrapper clusterWrapper() { .withUsername("test_user") .withPassword("test_password") .withDatabaseName("test_database") - .withPostgresVersion("17.4") + .withPostgresVersion("17.6.0") .build(); } diff --git a/spring-boot-app-example/src/test/java/io/github/mfvanek/pg/cluster/DatabaseStructureStaticAnalysisTest.java b/spring-boot-app-example/src/test/java/io/github/mfvanek/pg/cluster/DatabaseStructureStaticAnalysisTest.java index 5e0cf46..85b6ee9 100644 --- a/spring-boot-app-example/src/test/java/io/github/mfvanek/pg/cluster/DatabaseStructureStaticAnalysisTest.java +++ b/spring-boot-app-example/src/test/java/io/github/mfvanek/pg/cluster/DatabaseStructureStaticAnalysisTest.java @@ -2,6 +2,8 @@ import io.github.mfvanek.pg.core.checks.common.DatabaseCheckOnHost; import io.github.mfvanek.pg.core.checks.common.Diagnostic; +import io.github.mfvanek.pg.model.column.Column; +import io.github.mfvanek.pg.model.column.ColumnWithType; import io.github.mfvanek.pg.model.dbobject.DbObject; import io.github.mfvanek.pg.model.table.Table; import io.github.mfvanek.pg.testing.PostgreSqlClusterWrapper; @@ -47,7 +49,7 @@ class DatabaseStructureStaticAnalysisTest { void checkPostgresVersion() { final String pgVersion = jdbcTemplate.queryForObject("select version();", String.class); assertThat(pgVersion) - .startsWith("PostgreSQL 17.4"); + .startsWith("PostgreSQL 17.6"); } @Test @@ -59,14 +61,20 @@ void databaseStructureCheckForPublicSchema() { .filter(DatabaseCheckOnHost::isStatic) .forEach(check -> { final ListAssert checkAssert = assertThat(check.check()) - .as(check.getDiagnostic().name()); + .as(check.getName()); - switch (check.getDiagnostic()) { - case COLUMNS_WITH_FIXED_LENGTH_VARCHAR -> checkAssert.hasSize(2); - case COLUMNS_WITHOUT_DESCRIPTION -> checkAssert.hasSize(4); - case TABLES_NOT_LINKED_TO_OTHERS -> checkAssert.hasSize(1) + switch (check.getName()) { + case "COLUMNS_WITH_FIXED_LENGTH_VARCHAR" -> checkAssert.hasSize(2); + case "COLUMNS_WITHOUT_DESCRIPTION" -> checkAssert.hasSize(4); + case "TABLES_NOT_LINKED_TO_OTHERS", "TABLES_WHERE_PRIMARY_KEY_COLUMNS_NOT_FIRST" -> checkAssert.hasSize(1) .asInstanceOf(list(Table.class)) .containsExactly(Table.of("employees")); + case "COLUMNS_WITH_TIMESTAMP_OR_TIMETZ_TYPE" -> checkAssert.hasSize(2) + .asInstanceOf(list(ColumnWithType.class)) + .containsExactly( + ColumnWithType.ofTimestamp(Column.ofNotNull("employees", "created_at")), + ColumnWithType.ofTimestamp(Column.ofNullable("employees", "updated_at")) + ); default -> checkAssert.isEmpty(); } });