通过Flyway只执行一个SQL文件

时间:2018-04-18 13:54:21

标签: java flyway

我的'resources / sql / create'文件夹中有多个SQL文件。我只想通过Flyway运行一个SQL文件。但以下不起作用:

final Flyway flyway = new Flyway();
flyway.setDataSource(jdbcUrl, "", "");
flyway.setLocations("classpath:sql/create/create_table_person.sql");
flyway.clean();
flyway.migrate();

如何只执行一个SQL文件?我无法删除其他文件,因为它们位于test-jar文件中。

1 个答案:

答案 0 :(得分:0)

您可以使用target参数显式请求迁移到某个版本。例如,使用CLI:

user => add some itemp to backet
backet <= knows about some discount if user purchase 2 items and register new pop-up that says if you add 2 you'll have 50% sale.
user => add another item to backet 
backet <= this item will not available till next week, register another pop-up.
user = > push Order
Order => (pop-up) Discount if 2 do you (Yes-break /No -continue) => Item available on next week will wait ( Yes - continue/ No- break) => if (all.Continue) => push Order.

使用Java lib应该是:

flyway migrate -target=1.2.3