I am using play framework and wondering a problem in evolutions. After I changed my models (e.g. add a field), I prepare proper sql script (both for UPs and DOWNs) e.g. 3.sql (assuming I have already 2 evolution scripts) and put in related folder.
But the play shows me this message:
Database 'default' needs evolution!
# !!! WARNING! This script contains DOWNS evolutions that are likely destructive
# --- Rev:2,Downs - 3ee3d8e
ALTER TABLE my_table DROP COLUMN low_priority;
# --- Rev:1,Downs - 4f92dc6
[ a long script which drops all tables!]
# --- Rev:1,Ups - 5501951
[ a long script creating tables ] # --- Rev:2,Ups - 3ee3d8e
ALTER TABLE my_tableADD COLUMN low_priority tinyint(1) default 0 not null;
# --- Rev:3,Ups - 397ada5 ALTER TABLE my_table CHANGE COLUMN low_priority lowpriority TINYINT(1) NOT NULL DEFAULT '0' ;
Why play (and actually its ORM : EBean) behaves this way? It should just run "UPs" of 3.sql (last evolution script) and not roll back through history!
P.S. I am speaking about my dev instance (As the above is not happening in PROD). But for some reasons I must have some heavy data in my dev DB and doing a "backup&restore" each time really takes time.
I founded why this happens. According to this link: