Updated models and migrations to new spec

This commit is contained in:
2022-08-17 19:36:47 +02:00
parent bc075805e2
commit 05804cb78a
22 changed files with 336 additions and 86 deletions

28
models/band.js Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
const {
Model
} = require('sequelize');
module.exports = (sequelize, DataTypes) => {
class Band extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
Band.hasMany(models.Character);
}
}
Band.init({
uniqueId: DataTypes.INTEGER,
name: DataTypes.STRING,
description: DataTypes.TEXT,
imageURL: DataTypes.STRING,
enabled: DataTypes.BOOLEAN
}, {
sequelize,
modelName: 'Band',
});
return Band;
};