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

Commit 9577de6d by Mick Hansen

Merge branch 'master' into milestones/2.0.0

2 parents cfbb81fe e528ac6c
Notice: All 1.7.x changes are present in 2.0.x aswell Notice: All 1.7.x changes are present in 2.0.x aswell
# v1.7.0-rc5
- sync() now correctly returns with an error when foreign key constraints reference unknown tables
- sync() no longer fails with foreign key constraints references own table (toposort self-dependency error)
# v1.7.0-rc4 # v1.7.0-rc4
- fixes issue with postgres sync and enums [#1020](https://github.com/sequelize/sequelize/issues/1020) - fixes issue with postgres sync and enums [#1020](https://github.com/sequelize/sequelize/issues/1020)
- fixes various issues with limit and includes [#1322](https://github.com/sequelize/sequelize/pull/1322) - fixes various issues with limit and includes [#1322](https://github.com/sequelize/sequelize/pull/1322)
......
...@@ -56,6 +56,9 @@ module.exports = (function() { ...@@ -56,6 +56,9 @@ module.exports = (function() {
} }
} }
deps = deps.filter(function (dep) {
return dao.tableName !== dep
})
sorter.add(dao.tableName, deps) sorter.add(dao.tableName, deps)
}) })
......
...@@ -488,6 +488,34 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () { ...@@ -488,6 +488,34 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
done() done()
}) })
}) })
it('handles self dependant foreign key constraints', function (done) {
var block = this.sequelize.define("block", {
id: { type: DataTypes.INTEGER, primaryKey: true },
name: DataTypes.STRING
}, {
tableName: "block",
timestamps: false,
paranoid: false
});
block.hasMany(block, {
as: 'childBlocks',
foreignKey: 'parent',
joinTableName: 'link_block_block',
useJunctionTable: true,
foreignKeyConstraint: true
});
block.belongsTo(block, {
as: 'parentBlocks',
foreignKey: 'child',
joinTableName: 'link_block_block',
useJunctionTable: true,
foreignKeyConstraint: true
});
this.sequelize.sync().done(done)
})
} }
describe("doesn't emit logging when explicitly saying not to", function() { describe("doesn't emit logging when explicitly saying not to", function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!