dockerfile.js
847 Bytes
'use strict'
const { Model } = require('sequelize')
module.exports = (sequelize, DataTypes) => {
class Dockerfile extends Model {
static associate(models) {
this.belongsTo(models.User, {
foreignKey: "userId"
})
this.hasMany(models.Image)
}
}
Dockerfile.init({
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
userId: {
allowNull: false,
type: DataTypes.INTEGER
},
filepath: {
allowNull: false,
type: DataTypes.STRING
},
content: {
allowNull: false,
type: DataTypes.TEXT('long')
}
}, {
sequelize,
modelName: 'Dockerfile'
})
return Dockerfile
}