Fixes issue #2373

Use field if supplied, otherwise fall back to attribute (fixes issue #2373)
Okay.  Do you want me to remove the previous pull request and push another
in the same branch, or add another branch?

Thanks.

On Wed, Oct 1, 2014 at 9:17 AM, Jan Aagaard Meier <notifications@github.com>
wrote:

> In test/dao-factory.test.js:
>
> > @@ -311,6 +311,19 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
> >        })))
> >      })
> >
> > +    it('allows unique on column with field aliases', function(done) {
> > +      var User = this.sequelize.define('UserWithUniqueFieldAlias', {
> > +        userName: { type: Sequelize.STRING, unique: 'user_name_unique', field: 'user_name' }
> > +      });
> > +      User.sync({ force: true })
> > +        .then(function() {
> > +          return done();
> > +        })
> > +        .catch(function(err) {
> > +          throw err;
> > +        });
>
> The then done() part is not needed. You can just return the promise chain
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/sequelize/sequelize/pull/2374/files#r18277053>.
>