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

Commit 513aeb16 by Jonathan Crossman

- adding second test for object style definition

- removing incomplete dataType check
- styling code more like the rest of the project
1 parent 94ce9588
......@@ -54,11 +54,6 @@ module.exports = (function() {
this.primaryKeys = {};
Utils._.each(this.attributes, function(dataTypeString, attributeName) {
// If you don't specify a valid data type lets help you debug it
if (dataTypeString === undefined) {
throw new Error("Unrecognized data type for field " + attributeName );
}
if ((attributeName !== 'id') && (dataTypeString.indexOf('PRIMARY KEY') !== -1)) {
self.primaryKeys[attributeName] = dataTypeString
}
......
......@@ -151,17 +151,15 @@ module.exports = (function() {
options = options || {}
var globalOptions = this.options
for (var name in attributes) {
if (attributes.hasOwnProperty(name)) {
var dataType = attributes[name]
if (Utils.isHash(dataType)) {
dataType = dataType.type
}
if (dataType === undefined) {
throw new Error('Unrecognized data type for field '+ name)
}
// If you don't specify a valid data type lets help you debug it
Utils._.each(attributes, function(dataType, name){
if (Utils.isHash(dataType)) {
dataType = dataType.type
}
}
if (dataType === undefined) {
throw new Error('Unrecognized data type for field '+ name)
}
})
if (globalOptions.define) {
options = Utils._.extend({}, globalOptions.define, options)
......
......@@ -215,6 +215,12 @@ describe(Helpers.getTestDialectTeaser("DAOFactory"), function() {
activity_date: Sequelize.DATe
})
}.bind(this), 'Unrecognized data type for field activity_date')
Helpers.assertException(function() {
this.sequelize.define('UserBadDataType', {
activity_date: {type: Sequelize.DATe}
})
}.bind(this), 'Unrecognized data type for field activity_date')
})
it('sets a 64 bit int in bigint', function(done) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!