Using PostgreSQL ENUM types

65 views
Skip to first unread message

Josh

unread,
Jul 29, 2012, 4:55:10 PM7/29/12
to Lobos Library
What would be the way to use a custom enum type in lobos migrations?

For example, here is the type:

CREATE TYPE order_status AS ENUM ('one', 'two', 'three');

Here is the migration:

(defmigration add-xyz-table
(up [] (create
(tbl :xyz
(order-status :status 100)
(money :price 100)
...
)))
(down [] (drop (table :xyz))))

It seems I can do something like:

(defn order-status [table name & options]
(apply column table name (data-type :order_status) options))

to have "order_status" available in migration, but this is just a
guess. What is the lobos expected way?

As a side question, can lobos be used to create a postgreSQL enum?

Thank you.
Reply all
Reply to author
Forward
0 new messages