bugfix: def / init order

This commit is contained in:
Baipyrus 2024-03-03 00:47:17 +01:00
parent cfc714611e
commit 2a695f24c6

View File

@ -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 };