发布于 2017-03-01 18:11:20
Ecto_enum现在支持postgres枚举类型的枚举#使用-母线-枚举类型
发布于 2016-05-13 17:40:20
也许我做错了什么,但我只是创建了这样的类型和字段:
# creating the database type
execute("create type post_status as enum ('published', 'editing')")
# creating a table with the column
create table(:posts) do
add :post_status, :post_status, null: false
end然后把字段变成一个字符串:
field :post_status, :string而且看起来很管用。
发布于 2016-11-01 18:06:09
“JustMichael”的小强化。如果需要回滚,可以使用:
def down do
drop table(:posts)
execute("drop type post_type")
endhttps://stackoverflow.com/questions/35245859
复制相似问题