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

Commit 37f79d4f by Sascha Depold

method for querying and creating tables

1 parent f114ad3f
Showing with 20 additions and 1 deletions
var Utils = require('./utils')
module.exports = (function() {
var QueryInterface = function(sequelize) {
this.sequelize = sequelize
}
QueryInterface.prototype.createTable = function() {
QueryInterface.prototype.__defineGetter__('QueryGenerator', function() {
return this.sequelize.connectorManager.getQueryGenerator()
})
QueryInterface.prototype.createTable = function(tableName, attributes, options) {
var self = this
return query .call(this, this.QueryGenerator.createTableQuery(tableName, attributes, options))
}
QueryInterface.prototype.dropTable = function() {
......@@ -51,5 +59,16 @@ module.exports = (function() {
}
// private
var query = function() {
var args = Utils._.map(arguments, function(arg, _) { return arg })
// add this as the second argument
if(arguments.length == 1) args.push(this)
return this.sequelize.query.apply(this.sequelize, args)
}
return QueryInterface
})()
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!