> You also bring up something I was not thinking about, how do you
> specify DB based constraints without causing problems when moving from
> one DB to another. Not to mention keeping you migrations straight with
> your current model. It seems to me that the constraints need to be
> somehow defined model side to keep all that model logic in one place.
> Meh, I don't have a good idea on how to solve that one.
I think validations should be separate from constraints. Those are
really two different things with different capabilities. I really
don't see the connection between them, and IMO there's no chance of
implementing something like that will work decently. Too coupled, too
complicated.
On the other hand, it would be good to have a way to add constraints
when creating or altering a table. Maybe something like:
DB.create_table :items do
...
constraint {:price > 0}
constraint :valid_discount {:discounted_price < :price}
end
DB.add_constraint :valid_discount {:discounted_price < :price}
I think that should satisfy those who need validations in the
database.
sharon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---