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

Commit 0a8db194 by Jan Aagaard Meier

Merge pull request #3815 from BridgeAR/keyword-after

Add support for keyword `after` in options of a field. Closes #3166
2 parents 8aea96b7 1f674608
# Next # Next
- [FEATURE] Add support for keyword `after` in options of a field (useful for migrations), only for MySQL. [#3166](https://github.com/sequelize/sequelize/pull/3166)
- [FIXED] Fix a case where `type` in `sequelize.query` was not being set to raw. [#3800](https://github.com/sequelize/sequelize/pull/3800) - [FIXED] Fix a case where `type` in `sequelize.query` was not being set to raw. [#3800](https://github.com/sequelize/sequelize/pull/3800)
- [FIXED] Fix an issue where include all was not being properly expanded for self-references [#3804](https://github.com/sequelize/sequelize/issues/3804) - [FIXED] Fix an issue where include all was not being properly expanded for self-references [#3804](https://github.com/sequelize/sequelize/issues/3804)
......
...@@ -291,6 +291,10 @@ module.exports = (function() { ...@@ -291,6 +291,10 @@ module.exports = (function() {
template += ' PRIMARY KEY'; template += ' PRIMARY KEY';
} }
if (attribute.after) {
template += ' AFTER ' + this.quoteIdentifier(attribute.after);
}
if (attribute.references) { if (attribute.references) {
attribute = Utils.formatReferences(attribute); attribute = Utils.formatReferences(attribute);
template += ' REFERENCES ' + this.quoteTable(attribute.references.model); template += ' REFERENCES ' + this.quoteTable(attribute.references.model);
......
...@@ -43,6 +43,10 @@ if (Support.dialectIsMySQL()) { ...@@ -43,6 +43,10 @@ if (Support.dialectIsMySQL()) {
arguments: [{id: {type: 'INTEGER', unique: true}}], arguments: [{id: {type: 'INTEGER', unique: true}}],
expectation: {id: 'INTEGER UNIQUE'} expectation: {id: 'INTEGER UNIQUE'}
}, },
{
arguments: [{id: {type: 'INTEGER', after: 'Bar'}}],
expectation: {id: 'INTEGER AFTER `Bar`'}
},
// Old references style // Old references style
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!