imaginar/models/isotope.js

53 lines
1.0 KiB
JavaScript
Raw Permalink Normal View History

2024-10-19 11:24:54 +00:00
'use strict';
module.exports = (sequelize, DataTypes) => {
const Isotope = sequelize.define('Isotope', {
id: {
type: DataTypes.BIGINT,
autoIncrement: true,
primaryKey: true
},
name: {
type: DataTypes.STRING,
allowNull: false
},
firstPerson: {
type: DataTypes.STRING,
allowNull: false
},
personality: {
type: DataTypes.STRING,
allowNull: true
},
tone: {
type: DataTypes.STRING,
allowNull: true
},
backgroundStory: {
type: DataTypes.TEXT,
allowNull: true
},
likes: {
type: DataTypes.STRING,
allowNull: true
},
dislikes: {
type: DataTypes.STRING,
allowNull: true
},
user_id: {
type: DataTypes.BIGINT,
allowNull: false
}
}, {
tableName: 'isotopes',
underscored: true,
timestamps: true
});
Isotope.associate = function(models) {
Isotope.belongsTo(models.User, { foreignKey: 'user_id', onDelete: 'CASCADE' });
};
return Isotope;
};