Spring 启动 gradle flyway - 验证错误 - 模式验证:缺少 table

Spring boot gradle flyway - validate error - Schema-validation: missing table

我收到以下错误 无法构建 Hibernate SessionFactory;嵌套异常是 org.hibernate.tool.schema.spi.SchemaManagementException:模式验证:缺少 table [my.table]

这是版本问题吗?大多数例子连官方都不用schema? https://github.com/spring-projects/spring-boot/tree/main/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-flyway

数据库:MariaDB

步骤: 使用

创建 V1__init.sql

#spring.jpa.properties.javax.persistence.schema-generation.scripts.action=创建 #spring.jpa.properties.javax.persistence.schema-generation.scripts.create-目标=V1__init.sql #spring.jpa.properties.javax.persistence.schema-generation.scripts.create-源=元数据

然后添加了flyway插件

flyway.properties 与 build.gradle

处于同一级别

flyway.user=py1***

flyway.password=ENC(aCUoPgiA+ZyHDFdrEXa)

flyway.schemas=my

flyway.createSchemas=false

flyway.url=jdbc:mariadb://localhost:3306/my

flyway.locations=filesystem:db/migration

application.props

spring.jpa.properties.hibernate.default_schema=my

spring.jpa.hibernate.ddl-auto=validate

已将 V1__init.sql 移至 db\migrations

我的实体没有指定架构

@Entity
@Table(uniqueConstraints={
        @UniqueConstraint(....})
    }) 
public class SomeTable {...}

添加依赖项 - 实现 'org.flywaydb:flyway-core' 并已解决

(关于 json 类型列的下一个错误 - 找到 [longtext (Types#LONGVARCHAR)],但期望 [json (Types#VARCHAR)] 不在此范围内post)