Christophe Gillard
Christophe Gillard

Reputation: 3

Spring-boot Initialize a database with more than on file

I use spring-boot to initialize my (H2) database with several schema.sql files.

Here is the configuration :

spring.datasource.initialize=false
spring.datasource.schema=classpath*:db/schema*.sql

I see in the doc that if a pattern is used the scripts are executed in lexical order of their URL or filename. Is it possible to change this behaviour?

Upvotes: 0

Views: 506

Answers (1)

Andy Wilkinson
Andy Wilkinson

Reputation: 116091

There's no support for controlling the order in which the scripts are called. The expectation is that you'll have a single schema file for all DB platforms or one schema file per DB platform if you need to do anything that's platform-specific.

If you want more control over the initialisation of your database, the recommended approach is to use Flyway or Liquibase.

Upvotes: 2

Related Questions