DiscordJS-Example/models/messages.js

29 lines
612 B
JavaScript
Raw Normal View History

2024-03-02 23:49:36 +00:00
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
2024-02-06 15:18:06 +00:00
2024-02-11 01:04:12 +00:00
/**
* @typedef {Object} Message
* @property {string} id A Discord message ID.
2024-03-02 22:51:18 +00:00
* @property {string} guild A Discord guild ID as a foreign key reference.
2024-02-11 01:04:12 +00:00
*/
/**
* The definition of the `Message` table in the database.
* @param {Sequelize} sequelize
*/
2024-02-11 01:55:46 +00:00
export default function (sequelize) {
2024-02-06 15:18:06 +00:00
return sequelize.define('Messages', {
id: {
type: DataTypes.STRING,
primaryKey: true
2024-03-02 22:51:18 +00:00
},
guild: {
type: DataTypes.STRING,
references: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'Guilds',
key: 'id'
}
2024-02-06 15:18:06 +00:00
}
});
}