3 module.exports = function(sequelize, DataTypes) {
4 return sequelize.define('ReportJscriptyQuestion', {
5 question_id: DataTypes.INTEGER,
6 question_type: DataTypes.STRING,
7 question_label: DataTypes.STRING,
8 question_text: DataTypes.STRING,
9 question_answer: DataTypes.STRING,
10 question_other_label: DataTypes.STRING,
11 question_other_answer: DataTypes.STRING
14 tableName: 'report_jscripty_questions',
15 associate: function(models) {
16 models.ReportJscriptyQuestion.hasMany(models.ReportJscriptyInput, {
18 foreignKey: 'questionId'
21 models.ReportJscriptyQuestion.addScope('questionSummary', function(projectId) {
27 attributes: ['question_id', 'question_type', 'question_label', 'question_text', [sequelize.fn('count', sequelize.col('question_id')), 'count']],
28 group: ['question_id', 'question_type', 'question_label', 'question_text']