zonkyio / embedded-postgres

Java embedded PostgreSQL component for testing
Apache License 2.0
349 stars 46 forks source link

function gen_random_uuid() does not exist #85

Closed ztlsir closed 2 years ago

ztlsir commented 2 years ago

When I use flyway to migrate my DB in test,and then Throw Exception:"function gen_random_uuid() does not exist" There are versions of lib: testImplementation 'io.zonky.test.postgres:embedded-postgres-binaries-bom:14.2.0' testImplementation 'io.zonky.test:embedded-database-spring-test:2.1.1' testImplementation 'io.zonky.test:embedded-postgres:1.3.1'

ruckc commented 2 years ago

you need to specify the postgres binary version to >= 13 like the below provides postgresql 14.2

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.zonky.test.postgres</groupId>
                <artifactId>embedded-postgres-binaries-bom</artifactId>
                <version>14.2.0</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
tomix26 commented 2 years ago

@ztlsir As @ruckc wrote above, I also think the problem is related to an older version of postgres binaries. testImplementation 'io.zonky.test.postgres:embedded-postgres-binaries-bom:14.2.0' is not a correct command to change the version. You should use something like this: testImplementation platform('io.zonky.test.postgres:embedded-postgres-binaries-bom:14.2.0'). You can find more information here: https://docs.gradle.org/current/userguide/platforms.html#sub:bom_import