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

Configure Flyway for multiple datasource migrations #18699

Closed
muhammad-zpw opened this issue Oct 23, 2019 · 1 comment
Closed

Configure Flyway for multiple datasource migrations #18699

muhammad-zpw opened this issue Oct 23, 2019 · 1 comment

Comments

@muhammad-zpw
Copy link

I recently work in a project that require multiple data source in one Spring boot application. Obviously, I need migration mechanism for both data sources. I've took a look into Flyway auto-configuration here: https://github.com/spring-projects/spring-boot/blob/4d5d90847e7b6c9f3206a9ff0488ffd57d05f205/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java

As far as I understand the code, It seems like it only handle migration from one and only datasource. It would be great if we can do this via auto-configuration.

I still don't have a good idea to design the API, but what comes in my mind now is we can add a configuration like this:

@Configuration
class FlywayConfiguration {
    @Primary
    @FlywayDataSource(config = "PrimaryDataSourceConfig.class")
    public DataSource primaryDataSource() {
        ...
    }
    @FlywayDataSource(config = "SecondDataSourceConfig.class")
    public DataSource secondDataSource() {
        ...
    }    
}

If we declare several beans with @FlywayDataSource the auto-configuration will automatically configure those those datasource for us. I really appreciate for the help. Thanks.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 23, 2019
@wilkinsona
Copy link
Member

We'll consider this as part of #15732.

@wilkinsona wilkinsona removed the status: waiting-for-triage An issue we've not yet triaged label Oct 23, 2019
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

3 participants