0

我創建了一個播放2.0下的bean,並且evolutions會爲我創建一個1.sql DDL。播放2個演變應用blob和bytea進行測試和製作

這是實體包含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?

回答

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),所以在這種情況下,開發應用程序可能會更容易和更好環境爲ta rget one(這通常是最好的選擇)。