-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33078 from gastaldi/flyway_default_config
Revert "Cleanup Flyway Config"
- Loading branch information
Showing
12 changed files
with
214 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 12 additions & 17 deletions
29
extensions/flyway/runtime/src/main/java/io/quarkus/flyway/runtime/FlywayBuildTimeConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,35 @@ | ||
package io.quarkus.flyway.runtime; | ||
|
||
import java.util.Collections; | ||
import java.util.Map; | ||
|
||
import io.quarkus.datasource.common.runtime.DataSourceUtil; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithParentName; | ||
|
||
@ConfigMapping(prefix = "quarkus.flyway") | ||
@ConfigRoot(phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public interface FlywayBuildTimeConfig { | ||
@ConfigRoot(name = "flyway", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public final class FlywayBuildTimeConfig { | ||
|
||
/** | ||
* Gets the {@link FlywayDataSourceBuildTimeConfig} for the given datasource name. | ||
*/ | ||
default FlywayDataSourceBuildTimeConfig getConfigForDataSourceName(String dataSourceName) { | ||
public FlywayDataSourceBuildTimeConfig getConfigForDataSourceName(String dataSourceName) { | ||
if (DataSourceUtil.isDefault(dataSourceName)) { | ||
return defaultDataSource(); | ||
return defaultDataSource; | ||
} | ||
FlywayDataSourceBuildTimeConfig config = namedDataSources().get(dataSourceName); | ||
if (config == null) { | ||
config = defaultDataSource(); | ||
} | ||
return config; | ||
return namedDataSources.getOrDefault(dataSourceName, FlywayDataSourceBuildTimeConfig.defaultConfig()); | ||
} | ||
|
||
/** | ||
* Flyway configuration for the default datasource. | ||
*/ | ||
@WithParentName | ||
FlywayDataSourceBuildTimeConfig defaultDataSource(); | ||
@ConfigItem(name = ConfigItem.PARENT) | ||
public FlywayDataSourceBuildTimeConfig defaultDataSource; | ||
|
||
/** | ||
* Flyway configurations for named datasources. | ||
*/ | ||
@WithParentName | ||
Map<String, FlywayDataSourceBuildTimeConfig> namedDataSources(); | ||
} | ||
@ConfigItem(name = ConfigItem.PARENT) | ||
public Map<String, FlywayDataSourceBuildTimeConfig> namedDataSources = Collections.emptyMap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.