Updated models and migrations to new spec
This commit is contained in:
@@ -10,18 +10,16 @@ module.exports = (sequelize, DataTypes) => {
|
||||
* The `models/index` file will call this method automatically.
|
||||
*/
|
||||
static associate(models) {
|
||||
Character.hasMany(models.Card, {
|
||||
foreignKey: 'characterID',
|
||||
as: 'cards'
|
||||
});
|
||||
Character.belongsToMany(models.Card, { through: 'CardCharacter' });
|
||||
Character.belongsTo(models.Band, { foreignKey: 'bandId', });
|
||||
}
|
||||
}
|
||||
Character.init({
|
||||
name: DataTypes.STRING,
|
||||
rarity: DataTypes.INTEGER,
|
||||
description: DataTypes.STRING,
|
||||
bandId: DataTypes.INTEGER,
|
||||
imageURL: DataTypes.STRING,
|
||||
imageHash: DataTypes.STRING
|
||||
description: DataTypes.TEXT,
|
||||
enabled: DataTypes.BOOLEAN
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'Character',
|
||||
|
||||
Reference in New Issue
Block a user