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

Commit cfbb81fe by Mick Hansen

Merge branch 'master' into milestones/2.0.0

2 parents ced3269a 179f5e3a
...@@ -60,7 +60,7 @@ module.exports = (function() { ...@@ -60,7 +60,7 @@ module.exports = (function() {
}) })
sorter.sort().reverse().forEach(function(name) { sorter.sort().reverse().forEach(function(name) {
iterator(daos[name]) iterator(daos[name], name)
}) })
} }
......
...@@ -367,8 +367,12 @@ module.exports = (function() { ...@@ -367,8 +367,12 @@ module.exports = (function() {
// Topologically sort by foreign key constraints to give us an appropriate // Topologically sort by foreign key constraints to give us an appropriate
// creation order // creation order
this.daoFactoryManager.forEachDAO(function(dao) { this.daoFactoryManager.forEachDAO(function(dao, daoName) {
chainer.add(dao, 'sync', [options]) if (dao) {
chainer.add(dao, 'sync', [options])
} else {
// DB should throw an SQL error if referencing inexistant table
}
}) })
return chainer.runSerially() return chainer.runSerially()
......
...@@ -477,6 +477,17 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () { ...@@ -477,6 +477,17 @@ describe(Support.getTestDialectTeaser("Sequelize"), function () {
done() done()
}) })
}) })
it('returns an error correctly if unable to sync a foreign key referenced model', function (done) {
var Application = this.sequelize.define('Application', {
authorID: { type: Sequelize.BIGINT, allowNull: false, references: 'User', referencesKey: 'id' },
})
this.sequelize.sync().error(function (error) {
assert.ok(error);
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!