Comparing version 0.5.0 to 0.6.0
@@ -11,4 +11,5 @@ 'use strict'; | ||
this.table = config.table; | ||
this.name = config.name; | ||
this.star = config.star; | ||
for(var name in config) { | ||
this[name] = config[name]; | ||
} | ||
this.asc = this.ascending = this; | ||
@@ -15,0 +16,0 @@ this.alias = null; |
@@ -5,3 +5,3 @@ { | ||
"description": "sql builder", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"homepage": "https://github.com/brianc/node-sql", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -46,1 +46,33 @@ 'use strict'; | ||
}); | ||
test('table with fancier column definitions', function(t) { | ||
var table = Table.define({ | ||
name: 'blah', | ||
columns: [{ | ||
name: 'id', | ||
type: 'serial', | ||
notNull: true, | ||
primaryKey: true | ||
}, { | ||
name: 'email', | ||
type: 'text', | ||
notNull: true, | ||
unique: true, | ||
anythingYouWant: 'awesome' | ||
}] | ||
}); | ||
var cols = table.columns; | ||
t.equals(cols.length, 2); | ||
var id = cols[0]; | ||
t.equals(id.name, 'id'); | ||
t.equals(id.type, 'serial'); | ||
t.equals(id.notNull, true); | ||
t.equals(id.primaryKey, true); | ||
var email = cols[1]; | ||
t.equals(email.name, 'email'); | ||
t.equals(email.type, 'text'); | ||
t.equals(email.notNull, true); | ||
t.equals(email.unique, true); | ||
t.equals(email.anythingYouWant, 'awesome'); | ||
t.end(); | ||
}); |
77121
2091