
Document software (non-db) behavior of dm-constraints
Reported by bgentry | October 5th, 2009 @ 04:59 PM | in 0.10.2
The documentation does not explain the need to 'include DataMapper::Constraints' in a model in order to have DataMapper enforce the constraints on a software level (That is, without relying on the database constraints) so that constraints will still be enforced in non-FK databases like sqlite3.
Also, it may be helpful to explain how specifying a :destroy constraint should work for M:M relationships. Example:
class User
has n, :group_users
has n, :groups, :through => :group_users
end
class Group
has n :group_users
has n, :users, :through => :group_users
end
In the User class, where should the :destroy constraints be specified? On the intermediate :group_users model, or the final :groups model, or both? Docs seem to imply that both are necessary but should clarify this point.
Comments and changes to this ticket
-
Dan Kubb (dkubb) October 7th, 2009 @ 01:05 PM
- Milestone set to 0.10.2
- State changed from new to accepted
-
Dan Kubb (dkubb) October 23rd, 2009 @ 01:57 PM
I think we should make it so when you require dm-constraints, we automatically include DataMapper::Constraints into each model. If you don't use it, then it's a no-op, but if you do specify the :constraint option on a has() declaration, I can't see anyone indending for just db-level constraints and not software-level constraints.
-
Dan Kubb (dkubb) November 10th, 2009 @ 01:27 AM
- State changed from accepted to resolved
(from [21ffecfaf341b641495f8bf746f4ee76bf202c29]) [dm-constraints] Automatically add constraints to all models when required
- This change is consistent with behavior of other DM plugins.
- Minor doc update to show that intermediaries inherit constraints from the anonymous m:m relationships.
[#1078 state:resolved] http://github.com/datamapper/dm-more/commit/21ffecfaf341b641495f8bf...
-
Dan Kubb (dkubb) November 10th, 2009 @ 01:27 AM
(from [21ffecfaf341b641495f8bf746f4ee76bf202c29]) [dm-constraints] Automatically add constraints to all models when required
- This change is consistent with behavior of other DM plugins.
- Minor doc update to show that intermediaries inherit constraints from the anonymous m:m relationships.
[#1078 state:resolved] http://github.com/datamapper/dm-more/commit/21ffecfaf341b641495f8bf...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Referenced by
-
1078 Document software (non-db) behavior of dm-constraints [#1078 state:resolved] http://github.com/datamapper/dm-m...
-
1078 Document software (non-db) behavior of dm-constraints [#1078 state:resolved] http://github.com/datamapper/dm-m...