Play Framework 2.3如何重置数据库? [英] Play Framework 2.3 how to reset database?

查看:88
本文介绍了Play Framework 2.3如何重置数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Play 2.3.x 有关Evolution的文档中它说

In the Play 2.3.x documentation on Evolutions it says

但是,在开发模式下,简单地破坏开发数据库并从一开始就重新应用所有演变通常更为简单.

In development mode however it is often simpler to simply trash your development database and reapply all evolutions from the beginning.

但是,它没有给出有关如何执行此操作的说明.我可以使用某种激活器命令来执行此操作吗?如何重置和重新应用进化?

However it doesn't give instructions on how to do this. Is there some kind of activator command I can use to do this? How can I reset and reapply evolutions?

谢谢!

更新:我希望不必手动弄乱数据库,但这似乎是唯一的方法

Update: I would prefer not to have to mess with my DB manually, but it seems like that's the only way

推荐答案

我不认为有这样的激活器命令可以重新应用所有改进.

I dont think there is such activator command which would reapply all the evolutions.

一个演化过程由上下两部分组成,其中

An evolutions consist of 2 part Ups and Downs where

  1. Ups部分描述了所需的转换.
  2. 描述如何还原它们的Downs部分.

  1. The Ups part the describe the required transformations.
  2. The Downs part that describe how to revert them.

当您第一次应用Evolution时,将应用Ups零件,然后进一步通过实体更改架构.它将在ebean中重新应用Evolution.

when you apply evolution first time an Ups part is applied and if further you change the schema through entity.It would reapply evolutions in ebean.

如果要还原,请创建一个新的dotsql文件,说2.sql,所有drop语句中都包含Ups.

If you want to revert create a new dotsql file say 2.sql with Ups part of all drop statements.

通过这个

但是在开发模式下,简单地丢弃您的垃圾通常会更简单 开发数据库,​​并从一开始就重新应用所有演变.

In developement mode however it is often simpler to simply trash your developement database and reapply all evolutions from the beginning.

我认为它们的意思是通过数据库gui等手动删除所有数据库.

I think they mean to manually drop all the database through your database gui etc.

也请检查类似

这篇关于Play Framework 2.3如何重置数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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