SequelizeDatabaseError because of array?

Hello šŸ‘‹ So I am trying to make a database This code works just fine
const Sequelize = require("sequelize");
const sequelize = require("../utils/database");

const Guild = sequelize.define("guild", {
id: {
type: Sequelize.STRING,
primaryKey: true,
},
applicantChannelId: {
type: Sequelize.STRING,
allowNull: true,
},
});

module.exports = Guild;
const Sequelize = require("sequelize");
const sequelize = require("../utils/database");

const Guild = sequelize.define("guild", {
id: {
type: Sequelize.STRING,
primaryKey: true,
},
applicantChannelId: {
type: Sequelize.STRING,
allowNull: true,
},
});

module.exports = Guild;
But once I try to do this but with an array I get an arror
const Sequelize = require("sequelize");
const sequelize = require("../utils/database");

const Guild = sequelize.define("guild", {
id: {
type: Sequelize.STRING,
primaryKey: true,
},
applicantChannelId: {
type: Sequelize.STRING,
allowNull: true,
},
applicationQuestions: {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
},
});

module.exports = Guild;
const Sequelize = require("sequelize");
const sequelize = require("../utils/database");

const Guild = sequelize.define("guild", {
id: {
type: Sequelize.STRING,
primaryKey: true,
},
applicantChannelId: {
type: Sequelize.STRING,
allowNull: true,
},
applicationQuestions: {
type: Sequelize.ARRAY(Sequelize.STRING),
allowNull: true,
},
});

module.exports = Guild;
ERROR:
name: 'SequelizeDatabaseError',
parent: [Error: SQLITE_ERROR: near "[]": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];'
},
original: [Error: SQLITE_ERROR: near "[]": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];'
},
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];',
parameters: {}
}
name: 'SequelizeDatabaseError',
parent: [Error: SQLITE_ERROR: near "[]": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];'
},
original: [Error: SQLITE_ERROR: near "[]": syntax error] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];'
},
sql: 'ALTER TABLE `guilds` ADD `applicationQuestions` VARCHAR(255)[];',
parameters: {}
}
I'd appreciate some help ;D
4 Replies
d.js toolkit
d.js toolkitā€¢2y ago
ā€¢ What's your exact discord.js npm list discord.js and node node -v version? ā€¢ Post the full error stack trace, not just the top part! ā€¢ Show your code! ā€¢ Explain what exactly your issue is. ā€¢ Not a discord.js issue? Check out #useful-servers.
Panda
PandaOPā€¢2y ago
[email protected] & node v18.12.1 bump?
treble/luna
treble/lunaā€¢2y ago
Not djs related, #other-js-ts
Panda
PandaOPā€¢2y ago
Ah my bad, ill repost there
Want results from more Discord servers?
Add your server