更新schema_version表並在flyway中執行修改後的PL/SQL程序包/過程而沒有代碼重複的最佳方式是什麼?Flyway - Oracle PL/SQL程序遷移
我的例子就需要一個類文件對每個PL/SQL代碼modicaition
public class V2_1__update_scripts extends AbstractMigration {
// update package and procedures
}
AbstractMigration類DB /更新執行文件文件夾中創建:
public abstract class AbstractMigration implements SpringJdbcMigration {
private static final Logger log = LoggerFactory.getLogger(AbstractMigration.class);
@Override
public void migrate(JdbcTemplate jdbcTemplate) throws Exception {
Resource packageFolder = new ClassPathResource("db/update");
Collection<File> files = FileUtils.listFiles(packageFolder.getFile(), new String[]{"sql"}, true);
for (File file : files) {
log.info("Executing [{}]", file.getAbsolutePath());
String fileContents = FileUtils.readFileToString(file);
jdbcTemplate.execute(fileContents);
}
}
}
有什麼執行PL/SQL代碼的更好方法?