Spring dosn't run flyway migrations automatically

59 Views Asked by At

When I run migrations manually, everything is ok. but when running spring boot application, flyway does not apply automatically. Is there other configuration which must fix it?

I expect flyway migrations to run automatically when I run spring boot application.

    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
1

There are 1 best solutions below

0
Python Dev On

I think you have some problems with indent, try to write:

  flyway:
    locations: classpath:db/migration/V1402.11.09.16.30.00__createtable.sql