[2.2.x] Asks for DB evolution with (DOWNS) for no reason

137 views
Skip to first unread message

John Papadakis

unread,
Nov 1, 2013, 6:14:44 AM11/1/13
to play-fr...@googlegroups.com
While migrating from 2.1.x to 2.2.x  play wants to run evolutions on the database for no reason. Essentially recreate the entire schema (data loss).
Going back to 2.1.x there is no need for evolutions. What's the case here?

Anton Ivinsky

unread,
Nov 2, 2013, 1:38:24 PM11/2/13
to play-fr...@googlegroups.com
Got same problem. Does anyone know what's the case?

Anton Ivinsky

unread,
Nov 3, 2013, 9:36:38 AM11/3/13
to play-fr...@googlegroups.com
In my case that was due to two things.
1) 
In previous versions of play framework (maybe 1.x, maybe 2.0.x, not sure, when) evolutions were stored in db with prefix whitespace in lines, like this:
CREATE TABLE Chapter (
    id bigint(20) NOT NULL AUTO_INCREMENT,
    name varchar(255) NOT NULL,
    PRIMARY KEY (id)
);

In recent versions all lines of evolution are trimmed:
CREATE TABLE Chapter (
id bigint(20) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
PRIMARY KEY (id)
);

2) In play 2.2 different evolutions are checked from first to last: first 1.sql is checked against evolution 1 in db, then 2, 3 and so on.
If some pair differs, all evolutions sgarting from different will need to be downgraded and upgraded.
In previous versions of play evolutions were checked from last to first-equal, so if your last evolutions were equal, other evolutions were not checked.

After this two changes play finds first evolutions with different whitespace and asks to reapply them.

As a solution you may manually update evolutions in db: delete all prefix whitespace in scripts, update hash.

But it would even be better if play ignores whitespace in evolutions both from database and application, not only from application.   

On Friday, November 1, 2013 12:14:44 PM UTC+2, John Papadakis wrote:

Anton Ivinsky

unread,
Nov 4, 2013, 8:34:43 PM11/4/13
to play-fr...@googlegroups.com
Another problem i found is that newline characters in evolutions script and database may differ. Play wants them to be unix style.

воскресенье, 3 ноября 2013 г., 16:36:38 UTC+2 пользователь Anton Ivinsky написал:
Reply all
Reply to author
Forward
0 new messages