database
I have a file called database.js
const client = requre('Client.js');
const Sequelize = require('sequelize');
and here is my command file:
23 Replies
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ran the command and it gave the error that something went wrong
ill do dat rn
you don't have blocked defined in the command file
so would i have to require it from my database file?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
yes, i am
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Ok
do i need to export it
@lonedefense
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
https://discloud.app/logs/1df64729a80dfd375e5790fdcc258109d3fe
i keep getting this
ik what it means but idk what file
its comign from
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh
ty
now im getting this
nvm
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ye im so confused abt this err
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
everything is called blocked so idk where its getting blockeds from
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
const blocked = sequelize.define('blocked', {
user: {
type: Sequelize.STRING,
unique: true,
},
});
module.exports = blocked;
and then i have this in my index.js
client.once(Events.clientReady, () => {
blocked.sync();
console.log('synced blocked users')
});
anyone
please
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
ok, but wdym didnt define the schema anywhere
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
how do i override the collection name?
isnt that right here
const blocked = sequelize.define('no', {
isnt no what the table will be called?
const blocked = sequelize.define('no', {
TableName: 'Blocked'
user: { type: Sequelize.STRING, unique: true, }, }); module.exports = blocked; like that? i still am stuck what if i dont need the 2nd parameter sequelize.define(modelName, attributes, options) i see that const Restricted = sequelize.define('Restricted', 'Restricted Users' { user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING }); module.exports = Restricted; would it be like that or something then like that then? const Restricted = sequelize.define( 'Restricted',{ user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING, define: { freezeTableName: true } }); module.exports = Restricted; would that work? sequelize.define('User', { user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING }, { tableName: 'Restricted Users' }); sorry it took me a second to understnad what u meant my .sync code is in index.js client.once(Events.clientReady, () => { Restricted.sync(); console.log('synced blocked users') }); No, only on when the client is ready im guessing where would i put .sync then? ? someone please help
user: { type: Sequelize.STRING, unique: true, }, }); module.exports = blocked; like that? i still am stuck what if i dont need the 2nd parameter sequelize.define(modelName, attributes, options) i see that const Restricted = sequelize.define('Restricted', 'Restricted Users' { user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING }); module.exports = Restricted; would it be like that or something then like that then? const Restricted = sequelize.define( 'Restricted',{ user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING, define: { freezeTableName: true } }); module.exports = Restricted; would that work? sequelize.define('User', { user: { type: Sequelize.STRING, unique: true, }, reason: Sequelize.TEXT, staff: Sequelize.STRING }, { tableName: 'Restricted Users' }); sorry it took me a second to understnad what u meant my .sync code is in index.js client.once(Events.clientReady, () => { Restricted.sync(); console.log('synced blocked users') }); No, only on when the client is ready im guessing where would i put .sync then? ? someone please help
This isn't even discord.js related #useful-servers