generated from Baipyrus/DiscordJS-Template
34 lines
798 B
JavaScript
34 lines
798 B
JavaScript
|
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
|
||
|
}
|
||
|
});
|
||
|
}
|