Given a migration like this:
Sequel.migration do
up do
create_table :order_states do
primary_key :id
foreign_key :order_id, :orders, null: false
column :state, String, null: false
column :timeframe, :tsrange, :index=>{:type=>:gist}
end
end
down do
drop_table :order_states
end
end
I'd like to add a constraint that for a given order_id no two timeframes
can overlap. From google it looks like the range portion of this should be:
`EXCLUDE USING gist (timeframe WITH &&)`
1) How do you write that in a Sequel Migration?
and
2) How do you add the condition that it be exclusive to a single order_id,
not exclusive across all order states?
Thanks!
Andrew
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.