문제

I created a bean under play 2.0 and evolutions would create a 1.sql DDL for me.

This is the entity contains blob type:

@Entity
@Table(name="image_info")
public class ImageInfo extends Model {

    .......

    @Constraints.Required
    private Blob image;

    .......
}

It create this DDL.

create table image_info (
  id                        bigint not null,
  image                     blob)

It worked locally for H2 db, however, not on Heroku Postgres. How could I automate the evolutions to create separate DDLs?

도움이 되었습니까?

해결책

In application.conf you can define many servers and decide on which server each model belongs:

ebean.orders="models.Order,models.OrderItem"
ebean.customers="models.Customer,models.Address"

you can then use this technique to build both DDL automatically

# the default is some config of postgress
ebean.default="models.*"

# h2
ebean.mylocalh2="models.*"

And it will work, however I'm afraid that you'll need to install Postgres locally (note - I checked the trick with MySQL - have no local PG), so in that case maybe it'll be just easier and better to develop application in the very similar environment as target one (which is generally always the best option).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top