Fixes and improvements for database and other things

Also continued to add to ticket creation stuff - now includes opening questions
This commit is contained in:
Isaac
2021-04-25 15:40:07 +01:00
parent 674f29b403
commit db94bf6969
16 changed files with 245 additions and 189 deletions

View File

@@ -3,12 +3,12 @@ module.exports = ({ config }, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('Category', {
id: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
primaryKey: true,
allowNull: false,
},
guild: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'guilds',

View File

@@ -3,13 +3,13 @@ module.exports = (client, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('ChannelEntity', {
channel: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket'
},
name: DataTypes.TEXT,
ticket: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket',
references: {

View File

@@ -3,7 +3,7 @@ module.exports = ({ config }, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('Guild', {
id: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
primaryKey: true,
allowNull: false,
},

View File

@@ -3,12 +3,12 @@ module.exports = (client, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('Message', {
id: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
primaryKey: true,
allowNull: false,
},
author: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
},
data: {
@@ -24,7 +24,7 @@ module.exports = (client, sequelize) => {
defaultValue: false,
},
ticket: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'tickets',

View File

@@ -8,12 +8,12 @@ module.exports = (client, sequelize) => {
},
name: DataTypes.TEXT,
role: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket'
},
ticket: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket',
references: {

View File

@@ -3,7 +3,7 @@ module.exports = (client, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('Survey', {
guild: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'guilds',

View File

@@ -7,17 +7,18 @@ module.exports = (client, sequelize) => {
allowNull: true,
},
survey: {
type: DataTypes.CHAR(18),
type: DataTypes.INTEGER,
allowNull: false,
unique: 'survey-ticket',
references: {
model: DB_TABLE_PREFIX + 'surveys',
key: 'id'
},
},
ticket: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket',
unique: 'survey-ticket',
references: {
model: DB_TABLE_PREFIX + 'tickets',
key: 'id'

View File

@@ -3,12 +3,12 @@ module.exports = (client, sequelize) => {
const { DB_TABLE_PREFIX } = process.env;
sequelize.define('Ticket', {
id: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
primaryKey: true,
allowNull: false,
},
category: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'categories',
@@ -16,7 +16,7 @@ module.exports = (client, sequelize) => {
},
},
closed_by: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: true,
},
closed_reason: {
@@ -24,7 +24,7 @@ module.exports = (client, sequelize) => {
allowNull: true,
},
creator: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
},
first_response: {
@@ -32,7 +32,7 @@ module.exports = (client, sequelize) => {
allowNull: true,
},
guild: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
references: {
model: DB_TABLE_PREFIX + 'guilds',
@@ -50,7 +50,7 @@ module.exports = (client, sequelize) => {
defaultValue: true
},
opening_message: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: true,
},
topic: {

View File

@@ -8,7 +8,7 @@ module.exports = (client, sequelize) => {
discriminator: DataTypes.STRING,
display_name: DataTypes.TEXT,
ticket: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket',
references: {
@@ -17,7 +17,7 @@ module.exports = (client, sequelize) => {
},
},
user: {
type: DataTypes.CHAR(18),
type: DataTypes.CHAR(19),
allowNull: false,
unique: 'id-ticket'
},