我在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')
有没有办法简化这个并使用DSL?
答案 0 :(得分:1)
constraint(:date_is_1_feb_or_1_aug,
Sequel.extract(:month, :date).cast(Integer)=>[2,8],
Sequel.extract(:day, :date).cast(Integer)=>1)