不要怂,就是干,撸起袖子干!

Commit 87de0d90 by Mick Hansen

fix test

1 parent 0258fff3
Showing with 22 additions and 17 deletions
...@@ -2011,10 +2011,7 @@ describe(Support.getTestDialectTeaser('Include'), function() { ...@@ -2011,10 +2011,7 @@ describe(Support.getTestDialectTeaser('Include'), function() {
var UserPerson = this.sequelize.define("UserPerson", { var UserPerson = this.sequelize.define("UserPerson", {
PersonId: { PersonId: {
type : Sequelize.INTEGER, type : Sequelize.INTEGER,
primaryKey : true, primaryKey : true
references : Person,
referencesKey : 'id',
field : 'id'
}, },
rank: { rank: {
...@@ -2025,10 +2022,7 @@ describe(Support.getTestDialectTeaser('Include'), function() { ...@@ -2025,10 +2022,7 @@ describe(Support.getTestDialectTeaser('Include'), function() {
var User = this.sequelize.define("User", { var User = this.sequelize.define("User", {
UserPersonId: { UserPersonId: {
type : Sequelize.INTEGER, type : Sequelize.INTEGER,
primaryKey : true, primaryKey : true
references : UserPerson,
referencesKey : 'id',
field : 'id'
}, },
login: { login: {
...@@ -2038,22 +2032,33 @@ describe(Support.getTestDialectTeaser('Include'), function() { ...@@ -2038,22 +2032,33 @@ describe(Support.getTestDialectTeaser('Include'), function() {
} }
}); });
Person.hasOne(UserPerson);
UserPerson.belongsTo(Person, { UserPerson.belongsTo(Person, {
foreignKey: { foreignKey: {
allowNull: false allowNull: false
} },
onDelete: 'CASCADE'
}); });
Person.hasOne(UserPerson, {
UserPerson.hasOne(User); foreignKey: {
allowNull: false
},
onDelete: 'CASCADE'
});
User.belongsTo(UserPerson, { User.belongsTo(UserPerson, {
foreignKey: { foreignKey: {
name: 'UserPersonId', name: 'UserPersonId',
allowNull: false allowNull: false
} },
onDelete: 'CASCADE'
});
UserPerson.hasOne(User, {
foreignKey: {
name: 'UserPersonId',
allowNull: false
},
onDelete: 'CASCADE'
}); });
return this.sequelize.sync({force: true}).then(function () { return this.sequelize.sync({force: true}).then(function () {
return Person.findAll({ return Person.findAll({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!