When initializing database, usually we cannot hardcode name of schema(in oracle terms), where to create objects. For example for local launch we can use default public schema, but if we testing agains real database, we should define correct schema name. It will be usefull, if we can substitute arbitrary parameters in script like it works with liquibase.
script example:
create table ${schemaName}.EXAMPLE_TABLE(...)
We can add parameters map to spring.sql.init properties, like that -
spring:
sql:
init:
schema-locations:
- classpath:database.sql
parameters:
schemaName: example_schema
If it's possible and you like this enhancement, i would like to discuss solution and contribute implementing it
Comment From: wilkinsona
Spring Boot's script-based database initialization builds upon Spring Framework's ResourceDatabasePopulator
classes for both JDBC and R2DBC which do not support parameter substitution. Furthermore, the script-based initialization is intentionally quite basic. If you have more sophisticated needs, we recommend using a more sophisticated tool that is focused on database initialization such as Flyway or Liquibase. Thanks anyway for the suggestion.