Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple files in quarkus.mybatis.initial-sql #341

Open
p91paul opened this issue Aug 9, 2023 · 2 comments
Open

Support multiple files in quarkus.mybatis.initial-sql #341

p91paul opened this issue Aug 9, 2023 · 2 comments

Comments

@p91paul
Copy link

p91paul commented Aug 9, 2023

It can be useful to be able to specify multiple initial sql files, expecially if one or more of them is generated.
Currently initial-sql seems to support a single file (

public void runInitialSql(RuntimeValue<SqlSessionFactory> sqlSessionFactory, String sql) {
), can it be enhanced to be able to specify many files?

To cite similar implementations in other frameworks, Spring supports this behavior through the spring.sql.init.schema-locations configuration; multiple files can be specified with a comma separator, like this:

spring:
  datasource:
    url: jdbc:h2:mem:test
    username: sa
    password: sa
  sql:
    init:
      schema-locations: classpath*:test-data/schema-h2.sql,classpath*:test-data/tables-h2.sql,classpath*:test-data/alias-h2.sql
@zhfeng
Copy link
Collaborator

zhfeng commented Aug 10, 2023

Thanks @p91paul and yeah, I think we can improve to support multiple files. Are you interesting to contribute?

@p91paul
Copy link
Author

p91paul commented Aug 10, 2023

Sorry, I made that suggestion because I think it's a nice addition, but I'm currently unable to sponsor this with my time or otherwise. Of course that means I won't expect any kind of timeline for implementation.

I'm currently working around this by using the INIT parameter in h2 connection string (because that's my specific use case for this feature).

Thanks for your work on this quarkus extension!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants