Skip to content

Document that schema.sql and data.sql will still be run when using Flyway or Liquibase but discourage their use #20920

Closed
@ghost

Description

Expected Behavior:

  • The sql file "src/main/resources/data.sql" is run independent from the database during start up
  • The sql file "src/test/resources/data.sql" is run independent from the database on test start

Actual Behavior:

  • The sql file "src/main/resources/data.sql" is only run with h2 and not postgres during start up
  • The sql file "src/test/resources/data.sql" is only run with h2 and not postgres on test start

Failed approaches:

  • Use property "spring.datasource.initialization-mode=always"
  • Use property "spring.liquibase.drop-first=true"
  • Use property "spring.jpa.hibernate.ddl-auto=create-drop"

Initial analyse:

  • With postgres there is no "DataSourceSchemaCreatedEvent" so the DataSourceInitializer.initSchema() is never run.

Example-project: https://github.com/hauer-io/liquibase

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions