2023-03-12 20:51:45 +01:00
|
|
|
const { DataTypes, Model } = require('sequelize')
|
|
|
|
|
|
|
|
module.exports = (sequelize) => {
|
|
|
|
class FileMetadata extends Model { }
|
|
|
|
|
|
|
|
FileMetadata.init({
|
|
|
|
id: {
|
|
|
|
type: DataTypes.UUID,
|
|
|
|
defaultValue: DataTypes.UUIDV4,
|
|
|
|
primaryKey: true
|
|
|
|
},
|
|
|
|
ino: DataTypes.STRING,
|
|
|
|
filename: DataTypes.STRING,
|
|
|
|
ext: DataTypes.STRING,
|
|
|
|
path: DataTypes.STRING,
|
|
|
|
size: DataTypes.BIGINT,
|
|
|
|
mtime: DataTypes.DATE(6),
|
|
|
|
ctime: DataTypes.DATE(6),
|
|
|
|
birthtime: DataTypes.DATE(6)
|
|
|
|
}, {
|
|
|
|
sequelize,
|
2023-03-13 23:13:31 +01:00
|
|
|
freezeTableName: true, // sequelize uses datum as singular of data
|
2023-03-12 20:51:45 +01:00
|
|
|
modelName: 'FileMetadata'
|
|
|
|
})
|
|
|
|
|
|
|
|
return FileMetadata
|
|
|
|
}
|