create attachment file table
This commit is contained in:
26
backend/models/attachments.js
Normal file
26
backend/models/attachments.js
Normal file
@@ -0,0 +1,26 @@
|
||||
function defineAttachment(sequelize, DataTypes) {
|
||||
const Attachment = sequelize.define("Attachment", {
|
||||
title: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
detail: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
},
|
||||
path: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
},
|
||||
});
|
||||
|
||||
Attachment.associate = (models) => {
|
||||
Attachment.belongsToMany(models.Case, {
|
||||
through: "caseAttachments"
|
||||
});
|
||||
};
|
||||
|
||||
return Attachment;
|
||||
}
|
||||
|
||||
module.exports = defineAttachment;
|
||||
Reference in New Issue
Block a user