'use strict';
+var _ = require('lodash');
+
module.exports = function(sequelize, DataTypes) {
var SquareProject = sequelize.define('SquareProject', {
name: {
type: DataTypes.STRING,
- unique: true,
+ unique: 'name',
allowNull: false,
validate: {
notEmpty: true
description: DataTypes.STRING,
notes: DataTypes.TEXT,
preproduction: {
- type: DataTypes.TEXT,
- length: 'long'
+ type: DataTypes.BLOB('long'),
+ get: function() {
+ if (this.getDataValue('preproduction')) {
+ return _.toString(this.getDataValue('preproduction'));
+ }
+ }
},
production: {
- type: DataTypes.TEXT,
- length: 'long'
+ type: DataTypes.BLOB('long'),
+ get: function() {
+ if (this.getDataValue('production')) {
+ return _.toString(this.getDataValue('production'));
+ }
+ }
}
}, {
- tableName: 'square_projects',
+ tableName: 'square_projects'
});
return SquareProject;