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

Commit 37ce868a by sdepold

delete method via query interface

1 parent eb305c3f
...@@ -31,10 +31,6 @@ module.exports = (function() { ...@@ -31,10 +31,6 @@ module.exports = (function() {
findAutoIncrementField.call(this) findAutoIncrementField.call(this)
} }
ModelFactory.prototype.__defineGetter__('QueryGenerator', function() {
return this.modelManager.sequelize.connectorManager.getQueryGenerator()
})
ModelFactory.prototype.__defineGetter__('QueryInterface', function() { ModelFactory.prototype.__defineGetter__('QueryInterface', function() {
return this.modelManager.sequelize.getQueryInterface() return this.modelManager.sequelize.getQueryInterface()
}) })
......
...@@ -27,10 +27,6 @@ module.exports = (function() { ...@@ -27,10 +27,6 @@ module.exports = (function() {
destroy: 'DestroyQuery' destroy: 'DestroyQuery'
} }
Model.prototype.__defineGetter__('QueryGenerator', function() {
return this.__definition.QueryGenerator
})
Model.prototype.__defineGetter__('QueryInterface', function() { Model.prototype.__defineGetter__('QueryInterface', function() {
return this.__definition.modelManager.sequelize.getQueryInterface() return this.__definition.modelManager.sequelize.getQueryInterface()
}) })
...@@ -141,7 +137,7 @@ module.exports = (function() { ...@@ -141,7 +137,7 @@ module.exports = (function() {
return this.save() return this.save()
} else { } else {
var identifier = this.__options.hasPrimaryKeys ? this.primaryKeyValues : this.id var identifier = this.__options.hasPrimaryKeys ? this.primaryKeyValues : this.id
return query.call(this, this.QueryGenerator.deleteQuery(this.__definition.tableName, identifier)) return this.QueryInterface.delete(this, this.__definition.tableName, identifier)
} }
} }
......
...@@ -61,8 +61,9 @@ module.exports = (function() { ...@@ -61,8 +61,9 @@ module.exports = (function() {
return query.call(this, sql, model) return query.call(this, sql, model)
} }
QueryInterface.prototype.destroy = function() { QueryInterface.prototype.delete = function(model, tableName, identifier) {
var sql = this.QueryGenerator.deleteQuery(tableName, identifier)
return query.call(this, sql, model)
} }
QueryInterface.prototype.select = function(factory, tableName, options, queryOptions) { QueryInterface.prototype.select = function(factory, tableName, options, queryOptions) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!