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

Transparently integrate Flyway 6.0's support JavaMigration instances created by DI frameworks #15446

Closed
axelfontaine opened this issue Dec 12, 2018 · 16 comments
Assignees
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement

Comments

@axelfontaine
Copy link

Starting with Flyway 6.0 (due out in Q1 2019), Spring users can use this to automatically use all JavaMigration Spring beans with Flyway:

import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.migration.JavaMigration;
import org.springframework.context.ApplicationContext;

...
ApplicationContext applicationContext = ...; // obtain a reference to Spring's ApplicationContext.

Flyway flyway = Flyway.configure()
    .dataSource(url, user, password)
    // Add all Spring-instantiated JavaMigration beans
    .javaMigrations(applicationContext.getBeansOfType(JavaMigration.class).values().toArray(new JavaMigration[0]))
    .load();
flyway.migrate();

Spring Boot is most certainly able to make this fully transparent for its users.

References:

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 12, 2018
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 14, 2018
@philwebb philwebb added this to the 2.2.x milestone Dec 14, 2018
@SammyVimes
Copy link
Contributor

Is there still no assignee? If so, I'd like to work on that task

@wilkinsona
Copy link
Member

@SammyVimes Thanks for the offer, but Flyway 6 has not yet been released so nothing can be done here at the moment.

@wilkinsona wilkinsona added the status: blocked An issue that's blocked on an external project change label Mar 13, 2019
@SammyVimes
Copy link
Contributor

@wilkinsona Yes, but it's possible to use Java migrations in Flyway Beta, so I thought I can add support for it and merge when the release comes out :)

@wilkinsona
Copy link
Member

Cool. If you'd like to prepare something against the beta, ready to be updated to the GA when it's released and then merged, that'd be much appreciated.

@SammyVimes
Copy link
Contributor

Done! Waiting for GA (looks like it will happen in the beginning of april).

Also, there has been slight API changes in Flyway6, so I had to fix the compatibility.

@wilkinsona
Copy link
Member

Great! Thanks very much. Would you mind splitting the changes into two separate commits? One that does the upgrade and makes the necessary changes for breaking API changes, and one that adds support for Java migrations?

@SammyVimes
Copy link
Contributor

Ofcourse!

SammyVimes added a commit to SammyVimes/spring-boot that referenced this issue Mar 15, 2019
@SammyVimes
Copy link
Contributor

SammyVimes commented Mar 15, 2019

Flyway6

AutoConfiguration

To clarify: I've put them to different branches, so I can rebase and squash Flyway6 branch when it will be released and then autoconfiguration branch could be rebased onto it.

@wilkinsona
Copy link
Member

This looks great. Thanks very much @SammyVimes. We'll look forward to Flyway 6's release so that we can get those changes merged.

@kedar-joshi
Copy link
Contributor

Flyway 6.0 is now GA.

@SammyVimes
Copy link
Contributor

Yay, thanks for the notice, I'll have merge request ready today!

@SammyVimes
Copy link
Contributor

SammyVimes commented Aug 19, 2019

Whoops, looks like flyway 6.0.0 is broken! Tests with H2 database usage fail and the commit log of flyway repo contains this commit (so H2 just doesn't work right now)

image

@wilkinsona
Copy link
Member

Looks like we'll have to wait for 6.0.1 which is currently scheduled for 27/8: https://github.com/flyway/flyway/milestone/37.

@kedar-joshi
Copy link
Contributor

Flyway 6.0.1 released https://github.com/flyway/flyway/releases/tag/flyway-6.0.1.

@SammyVimes
Copy link
Contributor

SammyVimes commented Aug 29, 2019

Good, I will update my code later this day

SammyVimes added a commit to SammyVimes/spring-boot that referenced this issue Aug 29, 2019
@wilkinsona wilkinsona removed the status: blocked An issue that's blocked on an external project change label Aug 29, 2019
SammyVimes added a commit to SammyVimes/spring-boot that referenced this issue Aug 29, 2019
@wilkinsona
Copy link
Member

Closing in favour of #17993.

@wilkinsona wilkinsona removed this from the 2.2.x milestone Aug 30, 2019
@wilkinsona wilkinsona added the status: superseded An issue that has been superseded by another label Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants