Peter Penzov
Peter Penzov

Reputation: 1726

Execute sql file on every startup using liquibase configuration

I want to create a SQL initialization file to populate test data every time on Spring startup:

databaseChangeLog:
  - changeSet:
      id: 0001
      author: test
      dbms: postgres
      changes:
        - sqlFile:
            - relativeToChangelogFile: true
            - path: data.sql

Do you know how I can configure it to be executed on every Spring startup?

Upvotes: 2

Views: 2906

Answers (1)

pleft
pleft

Reputation: 7915

You can use the following property. Now the specific changeSet will run every time

- changeSet:
    runAlways: true

https://docs.liquibase.com/concepts/basic/changeset.html

runAlways Executes the changeset on every run, even if it has been run before.

Upvotes: 3

Related Questions