Comparing version 0.3.7 to 0.3.8
@@ -15,3 +15,3 @@ // Generated by CoffeeScript 1.4.0 | ||
ConnectionManipulate.prototype._manipulateCreation = function(model, data, callback) { | ||
ConnectionManipulate.prototype._manipulateCreate = function(model, data, callback) { | ||
model = inflector.camelize(model); | ||
@@ -27,3 +27,3 @@ if (!this.models[model]) { | ||
ConnectionManipulate.prototype._manipulateDeletion = function(model, data, callback) { | ||
ConnectionManipulate.prototype._manipulateDelete = function(model, data, callback) { | ||
model = inflector.camelize(model); | ||
@@ -49,2 +49,19 @@ if (!this.models[model]) { | ||
ConnectionManipulate.prototype._manipulateDropModel = function(model, callback) { | ||
model = inflector.camelize(model); | ||
if (!this.models[model]) { | ||
return callback(new Error("model " + model + " does not exist")); | ||
} | ||
model = this.models[model]; | ||
return model.drop(callback); | ||
}; | ||
ConnectionManipulate.prototype._manipulateDropAllModels = function(callback) { | ||
var _this = this; | ||
return async.forEach(Object.keys(this.models), function(model, callback) { | ||
model = _this.models[model]; | ||
return model.drop(callback); | ||
}, callback); | ||
}; | ||
ConnectionManipulate.prototype._manipulateConvertIds = function(id_to_record_map, model, data) { | ||
@@ -98,3 +115,3 @@ var column, property, _ref, _results; | ||
_this._manipulateConvertIds(id_to_record_map, model, data); | ||
return _this._manipulateCreation(model, data, function(error, record) { | ||
return _this._manipulateCreate(model, data, function(error, record) { | ||
if (error) { | ||
@@ -110,5 +127,10 @@ return callback(error); | ||
model = key.substr(7); | ||
return _this._manipulateDeletion(model, data, callback); | ||
return _this._manipulateDelete(model, data, callback); | ||
} else if (key === 'deleteAll') { | ||
return _this._manipulateDeleteAllModels(callback); | ||
} else if (key.substr(0, 5) === 'drop_') { | ||
model = key.substr(5); | ||
return _this._manipulateDropModel(model, callback); | ||
} else if (key === 'dropAll') { | ||
return _this._manipulateDropAllModels(callback); | ||
} else { | ||
@@ -115,0 +137,0 @@ return callback(new Error('unknown command: ' + key)); |
{ | ||
"name": "cormo", | ||
"description": "ORM framework for Node.js", | ||
"version": "0.3.7", | ||
"version": "0.3.8", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "orm", |
147559
3952