Pergunta

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?

Foi útil?

Solução

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).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top