本文整理了Java中org.flywaydb.core.Flyway.configure()
方法的一些代码示例,展示了Flyway.configure()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flyway.configure()
方法的具体详情如下:
包路径:org.flywaydb.core.Flyway
类名称:Flyway
方法名:configure
暂无
代码示例来源:origin: apache/incubator-gobblin
private DatabaseJobHistoryStoreSchemaManager(Properties properties) {
flyway = new Flyway();
flyway.configure(properties);
flyway.setClassLoader(this.getClass().getClassLoader());
}
代码示例来源:origin: jooby-project/jooby
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
Config $base = flyway(conf.getConfig("flyway"));
Config $flyway = Try.apply(() -> flyway(conf.getConfig(name)).withFallback($base))
.orElse($base);
Flyway flyway = new Flyway();
Properties props = props($flyway);
flyway.configure(props);
if (!props.containsKey("flyway.url")) {
Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
DataSource dataSource = env.get(dskey)
.orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
flyway.setDataSource(dataSource);
}
// bind
env.serviceKey()
.generate(Flyway.class, name, key -> binder.bind(key).toInstance(flyway));
// commands:
Iterable<Command> cmds = commands(conf);
// eager initialization
cmds.forEach(cmd -> cmd.run(flyway));
}
代码示例来源:origin: tomoya92/pybbs
@PostConstruct
@DependsOn("dataSourceHelper")
public void migrate() {
Flyway flyway = Flyway.configure()
.dataSource(dataSource)
.locations("classpath:db/migration", "filesystem:db/migration")
.baselineOnMigrate(true)
.load();
flyway.migrate();
}
代码示例来源:origin: com.linkedin.gobblin/gobblin-metastore
private DatabaseJobHistoryStoreSchemaManager(Properties properties) {
flyway = new Flyway();
flyway.configure(properties);
flyway.setClassLoader(this.getClass().getClassLoader());
}
代码示例来源:origin: org.apache.gobblin/gobblin-metastore
private DatabaseJobHistoryStoreSchemaManager(Properties properties) {
flyway = new Flyway();
flyway.configure(properties);
flyway.setClassLoader(this.getClass().getClassLoader());
}
代码示例来源:origin: ws.ament.hammock/util-flyway
FlywayBean() {
Map<String, String> properties = ConfigLoader.loadAllProperties("flyway", false);
this.flyway = new Flyway();
Properties props = new Properties();
props.putAll(properties);
flyway.configure(props);
this.postCreate();
}
代码示例来源:origin: hammock-project/hammock
FlywayBean() {
Map<String, String> properties = ConfigLoader.loadAllProperties("flyway", false);
this.flyway = new Flyway();
Properties props = new Properties();
props.putAll(properties);
flyway.configure(props);
this.postCreate();
}
代码示例来源:origin: io.thorntail/flyway
@Override
public void contextInitialized(ServletContextEvent sce) {
ServletContext sc = sce.getServletContext();
Flyway flyway = new Flyway();
String dataSourceJndi = sc.getInitParameter(FLYWAY_JNDI_DATASOURCE);
if (dataSourceJndi != null) {
try {
DataSource dataSource = (DataSource) new InitialContext().lookup(dataSourceJndi);
flyway.setDataSource(dataSource);
} catch (NamingException ex) {
logger.log(Level.SEVERE, "Error while looking up DataSource", ex);
// Do not proceed
return;
}
} else {
String url = sc.getInitParameter(FLYWAY_JDBC_URL);
String user = sc.getInitParameter(FLYWAY_JDBC_USER);
String password = sc.getInitParameter(FLYWAY_JDBC_PASSWORD);
flyway.setDataSource(url, user, password);
}
// Configure with flyway.* system properties
flyway.configure(System.getProperties());
flyway.migrate();
}
代码示例来源:origin: redhat-developer-demos/istio-tutorial
private void populateData() {
final Flyway flyway = Flyway
.configure()
.dataSource(URL, USER, PASSWORD)
.load();
flyway.migrate();
}
代码示例来源:origin: org.jooby/jooby-flyway
@Override
public void configure(final Env env, final Config conf, final Binder binder) {
Config $base = flyway(conf.getConfig("flyway"));
Config $flyway = Try.apply(() -> flyway(conf.getConfig(name)).withFallback($base))
.orElse($base);
Flyway flyway = new Flyway();
Properties props = props($flyway);
flyway.configure(props);
if (!props.containsKey("flyway.url")) {
Key<DataSource> dskey = Key.get(DataSource.class, Names.named(name));
DataSource dataSource = env.get(dskey)
.orElseThrow(() -> new NoSuchElementException("DataSource missing: " + dskey));
flyway.setDataSource(dataSource);
}
// bind
env.serviceKey()
.generate(Flyway.class, name, key -> binder.bind(key).toInstance(flyway));
// commands:
Iterable<Command> cmds = commands(conf);
// eager initialization
cmds.forEach(cmd -> cmd.run(flyway));
}
代码示例来源:origin: flyway/flyway-test-extensions
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring-test
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring4-test
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring3-test
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: org.flywaydb.flyway-test-extensions/flyway-spring5-test
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: flyway/flyway-test-extensions
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: flyway/flyway-test-extensions
Flyway toReturn = Flyway.configure()
.configuration(getFlywayConfiguration())
.load();
代码示例来源:origin: org.flywaydb/flyway-gradle-plugin
@SuppressWarnings("unused")
@TaskAction
public Object runTask() {
try {
Map<String, String> envVars = ConfigUtils.environmentVariablesToPropertyMap();
Set<URL> extraURLs = new HashSet<>();
if (isJavaProject()) {
addClassesAndResourcesDirs(extraURLs);
addConfigurationArtifacts(determineConfigurations(envVars), extraURLs);
}
ClassLoader classLoader = new URLClassLoader(
extraURLs.toArray(new URL[0]),
getProject().getBuildscript().getClassLoader());
Flyway flyway = Flyway.configure(classLoader).configuration(createFlywayConfig(envVars)).load();
Object result = run(flyway);
((DriverDataSource) flyway.getConfiguration().getDataSource()).shutdownDatabase();
return result;
} catch (Exception e) {
throw new FlywayException(collectMessages(e, "Error occurred while executing " + getName()), e);
}
}
代码示例来源:origin: dropwizard/dropwizard-flyway
@Override
protected void run(final Namespace namespace, final Flyway flyway) throws Exception {
final Boolean namespaceBoolean = namespace.getBoolean(OUT_OF_ORDER);
final Boolean cleanOnValidationError = namespace.getBoolean(CLEAN_ON_VALIDATION_ERROR);
FluentConfiguration config = Flyway.configure(flyway.getConfiguration().getClassLoader()).configuration(flyway.getConfiguration());
if (namespaceBoolean != null) {
config.outOfOrder(namespaceBoolean);
}
if (cleanOnValidationError != null) {
config.cleanOnValidationError(cleanOnValidationError);
}
Flyway customFlyway = config.load();
customFlyway.validate();
}
}
代码示例来源:origin: dropwizard/dropwizard-flyway
final Boolean baselineOnMigrate = namespace.getBoolean(INIT_ON_MIGRATE);
FluentConfiguration config = Flyway.configure(flyway.getConfiguration().getClassLoader()).configuration(flyway.getConfiguration());
内容来源于网络,如有侵权,请联系作者删除!