Skip to content

Conversation

@sushantdhiman
Copy link
Contributor

@sushantdhiman sushantdhiman commented May 2, 2018

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Closes #9229

@codecov
Copy link

codecov bot commented May 2, 2018

Codecov Report

Merging #9382 into master will increase coverage by <.01%.
The diff coverage is 100%.

@sushantdhiman sushantdhiman merged commit f365f72 into master May 3, 2018
@sushantdhiman sushantdhiman deleted the has-one-source-key branch May 3, 2018 14:53
@callmez
Copy link

callmez commented Jul 13, 2018

hi, i m confuse that is this change support call with include method?
cause it's still not work for me.

const User = this.sequelize.define('User', {
    id: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      primaryKey: true,
      autoIncrement: true,
    },
    username: {
        type: Sequelize.STRING,
        unique: true,
       field: 'the_user_name_field'
    }
});
const Task = this.sequelize.define('Task', {
    title: Sequelize.STRING,
    username: Sequelize.STRING
});

User.hasOne(Task, { as: 'Task', foreignKey: 'username', sourceKey: 'username' });
User.findOne({ 
    where: { username: 'bob' },
    include: [ 'Task' ],
}); // for mysql still generate sql "ON `user`.`id` = `Task`.`username`"

@sushantdhiman
Copy link
Contributor Author

v5 only

@callmez
Copy link

callmez commented Jul 13, 2018

v5 still not work for me.

@sushantdhiman
Copy link
Contributor Author

report an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants