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

Commit 234c3d60 by Daniel Durante

Fixed up MySQL dialect.

1 parent cf2581ed
......@@ -289,7 +289,9 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
Parent.hasMany(Child, {as: 'Children', foreignKey: 'child_id', joinTableName: 'ParentRelationship'})
Child.hasMany(Parent, {as: 'Parents', foreignKey: 'parent_id', joinTableName: 'ParentRelationship'})
this.sequelize.sync({ force: true }).success(function() {
ParentJoin.sync({ force: true }).success(function() {
Parent.sync({ force: true }).success(function() {
Child.sync({ force: true }).success(function() {
Parent.create({name: 'mom'}).success(function(mom) {
parents.push(mom)
Parent.create({name: 'dad'}).success(function(dad) {
......@@ -310,6 +312,8 @@ describe(Helpers.getTestDialectTeaser("HasMany"), function() {
})
})
})
})
})
it("allows join table to be mapped and specified", function(done) {
var User = this.sequelize.define('User', { name: Helpers.Sequelize.STRING }, {underscore: true, freezeTableName: true})
......
......@@ -2445,8 +2445,11 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
})
describe('use of invalid table name', function() {
before(function(done) {
this.Post = this.sequelize.define('post', {
it("emits the error event as the referenced table name is invalid", function(done) {
this.timeout = 3500
var self = this
self.Post = self.sequelize.define('post', {
title: Sequelize.STRING,
authorId: {
type: Sequelize.INTEGER,
......@@ -2455,15 +2458,10 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
}
})
this.Author.hasMany(this.Post)
this.Post.belongsTo(this.Author)
done()
})
self.Author.hasMany(self.Post)
self.Post.belongsTo(self.Author)
it("emits the error event as the referenced table name is invalid", function(done) {
this.timeout = 2500
var self = this
this.Author.sync({ force: true }).success(function() {
self.Author.sync({ force: true }).success(function() {
self.Post.sync({ force: true }).success(function() {
if (dialect === 'sqlite') {
// sorry ... but sqlite is too stupid to understand whats going on ...
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!