Built motion from commit 7afcba0.|0.0.74
[motion.git] / server / models / tools_variable.js
1 'use strict';
2
3 module.exports = function(sequelize, DataTypes) {
4
5   var Variable = sequelize.define('Variable', {
6     name: {
7       type: DataTypes.STRING,
8       unique: true,
9       allowNull: false,
10       validate: {
11         notEmpty: true,
12       },
13     },
14     description: DataTypes.STRING
15   }, {
16     tableName: 'tools_variables',
17     associate: function(models) {
18       Variable.hasMany(models.ZendeskField);
19       Variable.hasMany(models.DeskField);
20       Variable.hasMany(models.SalesforceField);
21       Variable.hasMany(models.FreshdeskField);
22       Variable.hasMany(models.SugarcrmField);
23       Variable.addScope('fields', {
24         include: [{
25           all: true
26         }]
27       });
28     }
29   });
30
31   return Variable;
32
33 };