Files
yourpart3/backend/models/falukant/data/relationship.js

57 lines
1.2 KiB
JavaScript

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import FalukantCharacter from './character.js';
class Relationship extends Model {}
Relationship.init(
{
character1Id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
character2Id: {
type: DataTypes.INTEGER,
allowNull: false,
references: {
model: FalukantCharacter,
key: 'id',
},
onDelete: 'CASCADE',
},
relationshipTypeId: {
type: DataTypes.INTEGER,
allowNull: false,
onDelete: 'CASCADE',
},
widowFirstName1: {
type: DataTypes.STRING,
allowNull: true,
},
widowFirstName2: {
type: DataTypes.STRING,
allowNull: true,
},
nextStepProgress: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: 0,
},
},
{
sequelize,
modelName: 'Relationship',
tableName: 'relationship',
schema: 'falukant_data',
timestamps: true,
underscored: true,
}
);
export default Relationship;