更新时间:2022-11-29 22:54:10
遗憾的是 Ebean
只能创建 CREATE DDL
(而不能创建 UPDATE DDL
)(如在他们的群组中回答),因此您需要尽快切换到手动演进.
Unfortunately Ebean
can create only CREATE DDL
(and not UPDATE DDL
) (as answered on their group), therefore you need to switch to manual evolutions ASAP.
一些规则:
1.sql
由它创建的演变1.sql
中删除前两个注释,然后开始使用下一个数字 2.sql
、3.sql
编写自己的演变> 等.在切换到手动演变之前,尝试放置尽可能多的模型/字段.最大的部分将由插件自动完成.ALTERS
而不是 DROP/CREATE,它们应该同时具有:Ups
和 Downs
改变.1.sql
evolution created by it1.sql
and start to writing own evolutions with next numbers 2.sql
, 3.sql
etc. Try to place as many models/fields as possible before switching to manual evolutions. The biggest part will be done automatically by plugin.ALTERS
to existing tables/columns instead of DROP/CREATE, they should have both: Ups
and Downs
for each change.事实上,有时使用 DB gui 修改 DB 结构更容易,无论如何它主要适用于单个开发人员......当您需要与其他开发人员共享代码时,编写演变将是更好的选择.
De facto sometimes it's just easier to modify DB structure with DB gui, anyway it works mainly for the single developer... when you need to share your code with other developers writing evolutions will be better option.
如果一段时间后您将添加新模型的下一个大"部分,您可以再次启用临时自动 DDL 并使用本地 git 来复制新部分.然后恢复到自己的旋转并粘贴Ebean插件生成的新部分.
If after some time you'll add next 'big' portion of new models you can enable temporary auto DDL again and using local git just to copy new parts. Then revert to own revolution and paste new parts generated by Ebean plugin.