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

Commit eb034333 by Jan Aagaard Meier

Fix for mysql comment + references. Closes #1521

1 parent 791990dd
......@@ -325,6 +325,10 @@ module.exports = (function() {
template += " PRIMARY KEY"
}
if (dataType.comment && Utils._.isString(dataType.comment) && dataType.comment.length) {
template += " COMMENT " + this.escape(dataType.comment)
}
if(dataType.references) {
template += " REFERENCES " + this.quoteTable(dataType.references)
......@@ -344,10 +348,6 @@ module.exports = (function() {
}
if (dataType.comment && Utils._.isString(dataType.comment) && dataType.comment.length) {
template += " COMMENT " + this.escape(dataType.comment)
}
result[name] = template
} else {
result[name] = dataType
......
......@@ -1679,6 +1679,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
done()
})
})
it("works with comments", function (done) {
// Test for a case where the comment was being moved to the end of the table when there was also a reference on the column, see #1521
var Member = this.sequelize.define('Member', {})
, Profile = this.sequelize.define('Profile', {
id: {
type: Sequelize.INTEGER,
primaryKey:true,
references: Member,
referencesKey: 'id',
autoIncrement: false,
comment: 'asdf'
}
})
this.sequelize.sync({ force: true }).success(function () {
done()
})
})
})
describe("syntax sugar", function() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!