DiscordTickets/src/database/models/survey_response.model.js
2021-04-24 20:34:09 +01:00

29 lines
604 B
JavaScript

const { DataTypes } = require('sequelize');
module.exports = (client, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('SurveyResponse', {
answers: {
type: DataTypes.JSON,
allowNull: true,
},
survey: {
type: DataTypes.CHAR(18),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'surveys',
key: 'id'
},
},
ticket: {
type: DataTypes.CHAR(18),
allowNull: false,
unique: 'id-ticket',
references: {
model: DB_TABLE_PREFIX + 'tickets',
key: 'id'
},
},
}, {
tableName: DB_TABLE_PREFIX + 'survey_responses'
});
};