我有一个多租户应用程序,需要对每个租户的模式进行数据迁移。但是当我在代码中使用flyway.setSchema()
时,它会给出弃用警告。
有什么替代方案吗?
List<String> schemas = getExistingTenants();
for(int i=0;i < schemas.size(); i++)
{
Flyway flyway = Flyway.configure().dataSource(dataSource).load();
flyway.setSchemas(schemas.get(i));
flyway.migrate();
}
schemas
设置为列表(而不是单独设置)可能不是正确的方法。 - Mark Rotteveel