Implementation for #805: JdbcMigrations, Resolvers and FlywayCallbacks should have access to core configuration #811
Conversation
Is there a status update for this issue? Really need access to the config from within a JdbcMigration myself. |
I provided an adapted implementation. Once again: This implementation is backward compatible, because injection of config data is done via an optional interface. |
Resolved conflicts. However, currently tests fail that also fail in master, too. |
This patch in its current form does way too much. At this point I certainly don't feel like making DbSupport part of the public API. Could you isolate ONLY the FlywayConfiguration/ConfigurationAware part? Thanks, |
Agreed, moving DbSupport was too much. However, the other two changes work hand in hand and do not make much sense without each other. |
Fixed conflicts. Unfortunately, your current changes are all in the code changed by this PR, so this results in a lot of work in keeping it current. |
This still does way too much. PlaceholderReplacer and Scanner are now exposed in a public package, there is a new skipDefaultResolvers property, etc. Please isolate ONLY the FlywayConfiguration/ConfigurationAware part. Also please include the JavaDocs in FlywayConfiguration. |
Ok, I worked around exposing PlaceholderReplacer and Scanner (the way it was in the original PR). I also included JavaDoc as requested. However, there is still one internal api left: DbSupport. In order to replace built in Resolvers, the CustomResolver needs access to the DbSupport Object. In that case, I can not do a workaround, because of the state of DbSupport. I could (and acutally did in a previous step) refactor the internal part (DbSupport) into a separate, use-at-your-own-risk interface (DbSupportAware?). What do you think? (waiting on your feedback before merging again) |
Please move the CustomResolver support to a separate pull request. I would like to keep this one to literally just the FlywayConfiguration/ConfigurationAware part. It's big enough already with just that. |
Ok, I removed the custom resolver part. When you give me the go, I would start to merge to resolve the conflicts. I will create a new PR with the custom resolver part. |
Squashed and rebased. |
a366ca6
to
ddf6889
Getting closer, but still a little more trimming required Could you:
|
Javadoc and imports: sure As for the other changes:
(sent you an email via your website, might be easier to discuss this via phone) |
InjectionUtils is mileading as its name is generic, yet it only works for FlywayConfiguration. Simply add a private method to the Flyway class. Flyway.injectConfiguration() is something that can be done right before command.execute(...) in Flyway.execute(Command) |
Actually, that is what I did. Which works for the callbacks. Resolvers can be injected in the CompositeResolver (which I did). Thats already the second place for injection. Third place is the injection into custom migrations (jdbc/spring jdbc). So it makes sense to put it into a separate helper class (I am open for name suggestions). |
OK, I feel we're getting there. Can you remove that new sqlline dependency? |
Sure, sorry, that slipped into it because 1.1.8 can not be resolved from central. |
…e configuration Introduced a generic ConfigurationAware interface. This allows to inject Core configuration into resolvers, migrations and callbacks. Configuration is injected by using a new FlywayConfiguration interface, which provides read only access to flyway configuration. Right now, Flyway implements FlywayConfiguration directly.
So? No new dependencies please. |
I did not introduce a new dependency... It was only an entry in dependencyManagement... phoenix has a dependency on sqlline 1.1.8 which I did replace with 1.1.9, to be able to build it in my corporate environment. It was not meant to be included in the pull request and I did remove it already. (still, might make things easier for developers to put it back in - apart from this PR) |
OK. Thanks for clearing things up. |
Implementation for #805: JdbcMigrations, Resolvers and FlywayCallbacks should have access to core configuration
Introduced a generic ConfigurationAware interface.
If a custom resolver or callback implements
ConfigurationAware
, theFlywayConfiguration
get automatically injected. That way, resolvers and callbacks have access to important configurations like the locations (for custom resolvers) or PlaceholderResolvers.Right now, Flyway implements FlywayConfiguration directly.