运行 运行时 Java 代码内的飞路迁移
Run flyway migrations inside Java code during runtime
我希望能够在 运行 时间内在我的 Java 代码中进行 运行 Flyway 迁移,有没有办法实现?我似乎无法在文档中找到它。我正在使用 SQLite 数据库(如果这很重要的话)。
Flyway::migrate()
引用 documentation:
package foobar;
import org.flywaydb.core.Flyway;
public class App {
public static void main(String[] args) {
// Create the Flyway instance and point it to the database
Flyway flyway =
Flyway.configure()
.dataSource( "jdbc:h2:file:./target/foobar" , "scott" , "tiger" ) // (url, user, password)
.load() // Returns a `Flyway` object.
;
// Start the migration
flyway.migrate();
}
}
我希望能够在 运行 时间内在我的 Java 代码中进行 运行 Flyway 迁移,有没有办法实现?我似乎无法在文档中找到它。我正在使用 SQLite 数据库(如果这很重要的话)。
Flyway::migrate()
引用 documentation:
package foobar;
import org.flywaydb.core.Flyway;
public class App {
public static void main(String[] args) {
// Create the Flyway instance and point it to the database
Flyway flyway =
Flyway.configure()
.dataSource( "jdbc:h2:file:./target/foobar" , "scott" , "tiger" ) // (url, user, password)
.load() // Returns a `Flyway` object.
;
// Start the migration
flyway.migrate();
}
}