This repository has been archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
Uniqueness Enforcement #15
Comments
Hi @nhahn is this still an issue? |
taoeffect
added a commit
to taoeffect/sails-memory
that referenced
this issue
Jun 5, 2016
Just because the primary key is unchanged doesn't mean the uniqueness check shouldn't be enforced. I.e. if we have a table where the primary key is an email or whatever, the uniqueness check here breaks. This PR fixes that.
Just ran across this myself. Sent a fix in PR #30. |
Err, looks like my fix broke some tests. Currently investigating. |
taoeffect
added a commit
to taoeffect/sails-memory
that referenced
this issue
Jun 5, 2016
Addresses issue where: - Model has custom primaryKey (i.e. an email address) - A uniqueness constraint is placed on another attribute
OK, this is now fixed in #31, and this time all tests are passing! 😄 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I've been seeing an error when using the sails-memory adapter with models that don't explicitly specify
It seems in the
enforceUniqueness
function indatabase.js
, the call doattrDef.unique
is returning a function that returns an empty array rather than a value in the case of not having the unique key explicitly specified in the model.This causes this line of code
to always evaluate to true, rather than skipping over those attributes that do not have the uniqueness key. It this an issue with the way I am defining my model? Or is it supposed to return a function when there is no key present?
The text was updated successfully, but these errors were encountered: