3

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?

1
  • 1
    "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. Aug 28, 2012 at 13:55

1 Answer 1

4

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: Play! framework - database issue with Evolutions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.