aaaaaa
aaaaaa

Reputation: 1406

JPA model update [1.1.1]

I'm sure this is something very simple, but for the life of me can't find the correct keywords on google.

Basically I've updated a couple models since my last deployment. Dev is set up with the jpa.ddl default setting of create-drop. Now I read that prod isn't supposed to run with jpa.ddl=update, so does that mean I have to manually script a schema change? I couldn't find any documentation saying the correct way. I am also using playapps, so the database is set up there. I set up ssl, so I should have sql access via command line. However, I was having difficulty figuring out the syntax for modifying the db. I'm so used to a gui environment such as phpMySQL or microsoft's sql server. The errors specifically I'm getting are the following two (when running the application after uploading to prod).


Unsuccessful: alter table PhotoSlide add index FK57E3FABF5C905145 (aPhoto_id), add constraint FK57E3FABF5C905145 foreign key (aPhoto_id) references StorePhoto (id)

Cannot add or update a child row: a foreign key constraint fails (play/#sql-2e29_32, CONSTRAINT FK57E3FABF5C905145 FOREIGN KEY (aPhoto_id) REFERENCES StorePhoto (id))

Upvotes: 1

Views: 306

Answers (1)

Rama Vadakattu
Rama Vadakattu

Reputation: 1266

you can achieve that by using the migration module.More details you can find @ http://www.playframework.org/modules/migrate

The flow will be like the below: You push new code to prod --> you run migrations --> restart the server

More documentation at : https://github.com/dcardon/play-migrate/blob/master/documentation/manual/home.textile

With the latest version play supports migrations : http://www.playframework.org/documentation/1.2.4/evolutions

Upvotes: 1

Related Questions