DiscordJS-Example/models/keywords.js

34 lines
798 B
JavaScript
Raw Normal View History

2024-04-03 17:29:32 +00:00
import { DataTypes, Deferrable, Sequelize } from 'sequelize';
/**
* @typedef {Object} Keyword
* @property {string} id A universally unique id, generated by sequelize.
* @property {string} guild A Discord guild ID as a foreign key reference.
* @property {string} name The name of the keyword.
*/
/**
* The definition of the `Keyword` table in the database.
* @param {Sequelize} sequelize
*/
export default function (sequelize) {
return sequelize.define('Keywords', {
id: {
defaultValue: DataTypes.UUIDV4,
type: DataTypes.UUID,
primaryKey: true
},
guild: {
type: DataTypes.STRING,
references: {
deferrable: Deferrable.INITIALLY_IMMEDIATE,
model: 'Guilds',
key: 'id'
}
},
name: {
type: DataTypes.STRING
}
});
}