import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';

class Diary extends Model { }

Diary.init({
    userId: {
        type: DataTypes.INTEGER,
        allowNull: false},
    text: {
        type: DataTypes.TEXT,
        allowNull: false},
    createdAt: {
        type: DataTypes.DATE,
        defaultValue: DataTypes.NOW},
    updatedAt: {
        type: DataTypes.DATE,
        defaultValue: DataTypes.NOW}
}, {
    sequelize,
    modelName: 'Diary',
    tableName: 'diary',
    schema: 'community',
    timestamps: true,
    underscored: true});

export default Diary;
