homepage.js/models/guestbook.js

55 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-02-22 14:54:35 +01:00
const { Model } = require('sequelize');
class Guestbook extends Model {
/**
* Helper method for defining associations.
* This method is not a part of Sequelize lifecycle.
* The `models/index` file will call this method automatically.
*/
static associate(models) {
// define association here
2023-02-19 10:54:30 +01:00
}
2023-02-22 14:54:35 +01:00
}
const init = (sequelize, DataTypes) => {
let model = Guestbook.init({
2023-02-19 10:54:30 +01:00
id: {
type: DataTypes.BIGINT(11),
primaryKey: true,
autoIncrement: true,
allowNull: false
},
name: {
type: DataTypes.TEXT,
allowNull: false
},
email: DataTypes.TEXT,
text: {
type: DataTypes.TEXT,
allowNull: false
},
hidemail: {
type: DataTypes.BOOLEAN,
allowNull: false
},
ip: {
type: DataTypes.TEXT,
allowNull: false
},
hidden: {
type: DataTypes.BOOLEAN,
allowNull: false
},
time: {
type: DataTypes.BIGINT
}
}, {
sequelize,
2023-02-20 03:43:53 +01:00
modelName: 'Guestbook',
tableName: 'guestbook'
2023-02-19 10:54:30 +01:00
});
2023-02-22 14:54:35 +01:00
return model;
};
init.class = Guestbook;
return init;