Spring 不会自动运行 Flyway 迁移

问题描述 投票:0回答:1

当我手动运行迁移时,一切正常。但是当运行 Spring Boot 应用程序时,flyway 不会自动应用。 还有其他的吗 必须修复它的配置?

我希望当我运行 Spring Boot 应用程序时,flyway 迁移会自动运行。

    logging: level:
    org:
      hibernate:
        sql: DEBUG
        type:
          descriptor:
            sql:
              BasicBinder: TRACE
      flywaydb: DEBUG spring:datasource:
    url: jdbc:sqlserver://192.168.100.20;database=asd
    username: Sa
    password: Passw0rdjpa:
    properties:
      hibernate:
        search:
          default:
            indexmanager: elasticsearch
            elasticsearch:
              host: 127.0.0.1:9200
              index_schema_management_strategy: drop-and-create
              required_index_status: yellow
      javax:
        persistence:
          schema-generation:
            create-source: metadata
            scripts:
              action: update
              create-target: C:\script\db_migration.sql
      flyway:
         locations: 
         classpath:db/migration/V1402.11.09.16.30.00__createtable.sql
         baseline-on-migrate: true
         baseline-version: 1402.11.09.16.30.00
         out-of-order: true
         enabled: true
         schemas: hr
         default-schema: hr
         password: Passw0rd
         user: Sa
         url: jdbc:sqlserver://192.168.100.20;database=asd
         create-schemas: true
java spring-boot flyway dbmigrate
1个回答
0
投票

我认为你的缩进有一些问题,尝试写:

  flyway:
    locations: classpath:db/migration/V1402.11.09.16.30.00__createtable.sql
© www.soinside.com 2019 - 2024. All rights reserved.