本文整理了Java中com.googlecode.flyway.core.Flyway.setDataSource()
方法的一些代码示例,展示了Flyway.setDataSource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Flyway.setDataSource()
方法的具体详情如下:
包路径:com.googlecode.flyway.core.Flyway
类名称:Flyway
方法名:setDataSource
[英]Sets the datasource to use. Must have the necessary privileges to execute ddl.
[中]设置要使用的数据源。必须具有执行ddl所需的权限。
代码示例来源:origin: DeemOpen/zkui
public void checkNCreate() {
try {
Flyway flyway = new Flyway();
flyway.setDataSource(globalProps.getProperty("jdbcUrl"), globalProps.getProperty("jdbcUser"), globalProps.getProperty("jdbcPwd"));
//Will wipe db each time. Avoid this in prod.
if (globalProps.getProperty("env").equals("dev")) {
flyway.clean();
}
//Remove the above line if deploying to prod.
flyway.migrate();
} catch (Exception ex) {
logger.error("Error trying to migrate db! Not severe hence proceeding forward.");
}
}
代码示例来源:origin: ch.inftec.ju/ju-testing
@Override
public void execute(DataSource ds) {
Flyway flyway = new Flyway();
flyway.setDataSource(ds);
flyway.clean(); // FIXME: Try Liquibase.dropAll()
}
});
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
private void initialize(Flyway flyway) {
flyway.setLocations("com/intuit/wasabi/repository/impl/mysql/migration");
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
/**
* Initializes the database.
*
* @param flyway flyway instance
*/
void initialize(Flyway flyway, String mutagenRootResourcePath) {
flyway.setLocations(mutagenRootResourcePath);
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: com.intuit.wasabi/wasabi-repository-datastax
void initialize(Flyway flyway) {
flyway.setLocations("com/intuit/wasabi/repository/impl/mysql/migration");
flyway.setDataSource(transactionFactory.getDataSource());
flyway.migrate();
}
代码示例来源:origin: ch.inftec.ju/ju-testing
@Override
public void execute(DataSource ds) {
Flyway flyway = new Flyway();
flyway.setDataSource(ds);
flyway.setLocations(locations);
flyway.migrate();
}
});
代码示例来源:origin: SAP/olingo-jpa-processor-v4
flyway.setDataSource(ds);
flyway.setInitOnMigrate(true);
flyway.setSchemas(DB_SCHEMA);
代码示例来源:origin: minnal/minnal
public void init(Application<? extends ApplicationConfiguration> application) {
DatabaseConfiguration dbConfig = application.getConfiguration().getDatabaseConfiguration();
URI uri = getUri(dbConfig.getUrl());
if (Strings.isNullOrEmpty(uri.getPath())) {
flyway.setDataSource(dbConfig.getUrl(), dbConfig.getUsername(), dbConfig.getPassword());
} else {
flyway.setDataSource(getUrl(uri, false), dbConfig.getUsername(), dbConfig.getPassword());
flyway.setSchemas(uri.getPath().substring(1));
}
flyway.migrate();
}
代码示例来源:origin: com.googlecode.flyway/flyway-core
setDataSource(new DriverDataSource(driverProp, urlProp, userProp, passwordProp));
} else if (!StringUtils.hasText(urlProp) &&
(StringUtils.hasText(driverProp) || StringUtils.hasText(userProp) || StringUtils.hasText(passwordProp))) {
代码示例来源:origin: org.jabylon/db.migration
private void migrateDB(DataSource dataSource)
{
boolean dbExists = dbExists(dataSource);
Flyway flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setTable("SCHEMA_VERSION");
// flyway.setInitOnMigrate(true);
if (!dbExists)
{
MigrationVersion migrationVersion = getLatestVersion(flyway);
if (migrationVersion != null)
flyway.setInitVersion(migrationVersion);
}
MigrationInfo current = flyway.info().current();
if (current == null)
flyway.init();
flyway.migrate();
}
代码示例来源:origin: com.googlecode.flyway/flyway-ant
Flyway flyway = new Flyway();
flyway.setDataSource(createDataSource());
String schemasValue = useValueIfPropertyNotSet(schemas, "schemas");
if (schemasValue != null) {
代码示例来源:origin: jvelo/mayocat-shop
@Override
protected void run(Bootstrap<T> bootstrap, Namespace namespace, T configuration) throws Exception
{
final DataSourceFactory dbConfig = strategy.getDataSourceFactory(configuration);
dbConfig.setMaxSize(1);
dbConfig.setMinSize(1);
Flyway flyway = new Flyway();
flyway.setLocations(MAYOAPP_MIGRATIONS);
flyway.setDataSource(dbConfig.getUrl(), dbConfig.getUser(), dbConfig.getPassword());
if (flyway.info().current() == null) {
flyway.setInitVersion("0000.0001");
flyway.init();
}
flyway.migrate();
}
}
内容来源于网络,如有侵权,请联系作者删除!