如何在Sequel Postgresql迁移中定义ARRAY列?

bea*_*ecz 7 ruby database migration postgresql sequel

我正在创建一个Sequel迁移来在我的PostgreSQL数据库中创建一个新表.我想定义一个PostgreSQL支持的String数组列.

我的迁移看起来像这样:

create_table :venues do
  primary_key :id

  String      :reference                                , :null => false
  String      :name                                     , :null => false
  String      :description                              , :null => false
  String[]    :type                                     , :null => false

  DateTime    :created_at                               , :null => false
  DateTime    :updated_at                               , :null => false
end
Run Code Online (Sandbox Code Playgroud)

如何定义text[]迁移中的内容?

Jer*_*ans 17

您只需使用column方法并将类型指定为字符串: column :type, "text[]"