water-orm
Version:
A monolith version of Standalone waterline ORM
47 lines (41 loc) • 953 B
JavaScript
/**
* Dependencies
*/
var path = require('path');
var Waterline = require(path.join(process.cwd(),'lib/waterline.js'));
module.exports = Waterline.Collection.extend({
identity: 'user',
tableName: 'usertablesql',
connection: 'sql',
attributes: {
first_name: 'string',
last_name: 'string',
email: {
type: 'string',
columnName: 'emailAddress'
},
avatar: 'binary',
title: 'string',
phone: 'string',
type: 'string',
favoriteFruit: {
defaultsTo: 'blueberry',
type: 'string'
},
age: 'integer', // integer field that's not auto-incrementable
dob: 'datetime',
status: {
type: 'boolean',
defaultsTo: false
},
percent: 'float',
list: {
type: 'array',
columnName: 'arrList'
},
obj: 'json',
fullName: function() {
return this.first_name + ' ' + this.last_name;
}
}
});