generated from Baipyrus/DiscordJS-Template
bugfix: def / init order
This commit is contained in:
parent
cfc714611e
commit
2a695f24c6
16
database.js
16
database.js
@ -16,14 +16,6 @@ const sequelize = new Sequelize({
|
||||
logging: false
|
||||
});
|
||||
|
||||
const Guild = defineGuild(sequelize);
|
||||
Guild.hasMany(VoiceChannel, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
Guild.hasMany(Message, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
Guild.hasMany(Role, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
|
||||
const Role = defineRole(sequelize);
|
||||
Role.hasMany(RoleEmojiPair, { foreignKey: 'role', onDelete: 'CASCADE' });
|
||||
|
||||
const RoleEmojiPair = defineRoleEmojiPair(sequelize);
|
||||
|
||||
const VoiceChannel = defineVoiceChannel(sequelize);
|
||||
@ -31,5 +23,13 @@ const VoiceChannel = defineVoiceChannel(sequelize);
|
||||
const Message = defineMessage(sequelize);
|
||||
Message.hasMany(RoleEmojiPair, { foreignKey: 'message', onDelete: 'CASCADE' });
|
||||
|
||||
const Role = defineRole(sequelize);
|
||||
Role.hasMany(RoleEmojiPair, { foreignKey: 'role', onDelete: 'CASCADE' });
|
||||
|
||||
const Guild = defineGuild(sequelize);
|
||||
Guild.hasMany(VoiceChannel, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
Guild.hasMany(Message, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
Guild.hasMany(Role, { foreignKey: 'guild', onDelete: 'CASCADE' });
|
||||
|
||||
sequelize.sync();
|
||||
export { sequelize, Guild, Role, RoleEmojiPair, VoiceChannel, Message };
|
||||
|
Loading…
Reference in New Issue
Block a user