strongloop/loopback-datasource-juggler — pull request #110 by bajtos (2014-05-14 18:44:49+00:00)
Title: validations: support multi-key unique constraint

Modify the "unique" validator to accept additional property names to
narrow the space of rows searched for duplicates.

Example:

Consider `SiteUser` belongsTo `Site` via `siteId` foreign key.
Inside every site, the user email must be unique. It is allowed to
register the same email with multiple sites.

SiteUser.validateUniquenessOf('email', { scopedTo: ['siteId'] });

/to @raymondfeng or @ritch please review.

This feature will be very useful for loopback-workspace to implement validations like "the model name must be unique within a project". At the moment, we have "the model name must be unique", which does not work when there was more than one project loaded during the app life.