0

我在 play 2.0 下创建了一个 bean,evolutions 将为我创建一个 1.sql DDL。

这是包含 blob 类型的实体:

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

    .......

    @Constraints.Required
    private Blob image;

    .......
}

它创建了这个 DDL。

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

它在本地适用于 H2 db,但不适用于 Heroku Postgres。我怎样才能使进化自动化以创建单独的 DDL?

4

1 回答 1

2

您可以在application.conf其中定义许多服务器并决定每个服务器model属于哪个服务器:

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

然后,您可以使用此技术自动构建两个 DDL

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

# h2
ebean.mylocalh2="models.*"

它会起作用,但是我担心你需要在本地安装 Postgres(注意 - 我用 MySQL 检查了这个技巧 - 没有本地 PG),所以在这种情况下,开发起来可能会更容易更好在与目标非常相似的环境中应用程序(通常始终是最佳选择)。

于 2012-05-30T19:59:27.707 回答