自动为Flyway生成迁移SQL [英] Automatic generation of migration SQL for Flyway
问题描述
当通过Java代码添加新的模型/字段等时,JPA/Hibernate的自动模式生成是否可以生成新的Flyway迁移.
Is it possible for new Flyway migrations to be generated by JPA/Hibernate's automatic schema generation when a new model / field etc. are added via Java code.
捕获自动生成的SQL并将其直接保存到新的Flyway迁移中,以进行查看/编辑/提交到项目存储库将非常有用.
It would be useful to capture the auto-generated SQL and save it directly to a new Flyway migration, for review / editing / committing to a project repository.
在此先感谢您提供的任何帮助或启发.
Thank you in advance for any assistance or enlightenment you can offer.
推荐答案
Flyway没有对diff的内置支持,我在Maven Spring Boot项目中使用Liquidbase,并且可以通过使用以下内容从JPA/休眠更改中创建变更日志:
Flyway doesn't have built-in support for diff, I use liquidbase within a maven spring boot project and changelogs can be created from JPA/hibernate changes by using:
mvn liquibase:diff
liquibase diff的所有选项都位于此处: http://www.liquibase.org/documentation/maven/maven_diff.html
All of the options for liquibase diff are located here: http://www.liquibase.org/documentation/maven/maven_diff.html
这篇关于自动为Flyway生成迁移SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!