playframework-如何自动增加演变 [英] playframework - how to automatically increment evolutions

查看:73
本文介绍了playframework-如何自动增加演变的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在使用playframework 2.0,并且我的应用程序已准备好发布.在开发过程中,我注意到: 每次我添加/修改模型层时,conf \ evolutions \ default \ 1.sql都会自动更改. 当我即将发布我的应用程序时,我想知道如何设置它以开始将其添加到2.sql而不是1?我想对修订进行标记/分支,以便将来将来升级版本时,系统将注意到它已安装1.sql,因此只需要运行2.sql.

So I'm using playframework 2.0 and my application is ready for release. as I have been developing I have noticed that: conf\evolutions\default\1.sql has been automatically changing each time I add/modify my model layer. As I am about to release my application I was wondering how do I set this to start adding it to 2.sql instead of 1? I would like to tag/branch the revision so that if I need to upgrade my release in the future the system will notice that it has 1.sql installed so it will only need to run 2.sql.

我当前正在使用JDBC数据库,并注意到在开发过程中如果进行任何更改,它将更新1.sql,然后在下次运行该应用程序时,它将清除所有数据.

I am currently using a JDBC databse, and noticed that during development if I made any changes it would update 1.sql and then the next time I ran the application it would wipe all my data clean.

那么如何使演化1完成呢?

So how do I make it so evolution 1 is finished?

我目前有配置选项:applyEvolutions.default = true

I currently have the config option: applyEvolutions.default=true

这不是发布的好主意吗?

is this a bad idea for release?

感谢您的帮助

推荐答案

这绝对是个坏主意

Ebean不会创建ALTERS,而是创建DDL版本,因此,如果您要修改任何模型并将其发送到生产环境,它将 DROP 所有表并重新创建它们.当然,所有数据都会丢失.

It's definitely bad idea

Ebean doesn't create ALTERS but CREATE version of DDLs, so in case you'll modify any model and will send it to the production it will DROP all tables and recreate them. Of course all data will be lost.

因此,您需要从1.sql中删除第一行,以禁用Ebean对文件的修改.

Therefore you need to remove two first lines from the 1.sql to disable modyfying the file by Ebean.

从现在开始,您需要手动创建2.sql之类的文件,然后手动创建.在这些新文件中,您只需添加修改语句.

From now you'll need create files like 2.sql and next manually. In these new files you need to add only modifying statement.

这篇关于playframework-如何自动增加演变的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆