How do I define an ARRAY column in a Sequel Postgresql migration?

戏子无情 提交于 2019-12-07 00:08:15

问题


I am creating a Sequel migration to create a new table in my PostgreSQL database. I want to define a String array column, which PostgreSQL supports.

My migration looks like this:

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

How can I define something like text[] in my migration?


回答1:


You just use the column method and specify the type as a string: column :type, "text[]"



来源:https://stackoverflow.com/questions/17677924/how-do-i-define-an-array-column-in-a-sequel-postgresql-migration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!