¿Cómo usar las evoluciones de la base de datos en modo Producción?

Currently, my evolutions are used in two ways (in a Play!2 app):

  1. They are used to define the structure of the database
  2. They are used to populate the database with some default values.

The Downs usually destroy whatever changes Ups may have done. I haven't used the evolutions in prod mode, but I understand that they are applied on startup of the app.

Does that mean that updating the app will cause the evolutions to be reapplied, thus cause me to lose all my data? If so, how can I avoid this?

preguntado el 28 de agosto de 12 a las 14:08

"When evolutions are activated, Play will check your database schema state before each request in DEV mode, or before starting the application in PROD mode. " As far as I understand, only new evolutions will be applied in this case, not the whole db is recreated from scratch. -

1 Respuestas

If you enable Evolutions in Production mode, the Downs part of your script will not be executed. For that you need to disable automatic generation of Evolution files by deleting the first 2 commented lines of the conf/evolutions/default/1.sql:

# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions

# --- !Ups
...

You can also take a look at this question for more details: ¡Jugar! framework - problema de la base de datos con Evolutions

contestado el 23 de mayo de 17 a las 11:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.