作者:justmoon999 | 来源:互联网 | 2022-12-02 17:05
我希望能够在运行时在Java代码中运行Flyway迁移,有没有办法实现这一目标?我似乎无法在文档中找到它。我正在使用SQLite数据库(如果这很重要)。
1> Basil Bourqu..:
Flyway::migrate()
致电Flyway::migrate
。
引用文档:
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", "sa", null)
.load();
// Start the migration
flyway.migrate();
}
}