Reputation: 918
I have the following constraint in a Sequel migratin:
constraint(:date_is_1_feb_or_1_aug, 'EXTRACT(MONTH FROM date)::INT IN (2,8) AND EXTRACT(DAY FROM date)::INT = 1')
Is there any way to simplify this and use the DSL?
Upvotes: 0
Views: 160
Reputation: 12139
constraint(:date_is_1_feb_or_1_aug,
Sequel.extract(:month, :date).cast(Integer)=>[2,8],
Sequel.extract(:day, :date).cast(Integer)=>1)
Upvotes: 1