import { InitOptions, Model, Sequelize, SyncOptions } from 'sequelize'; import { DataTypes } from 'sequelize'; export class Comment extends Model { declare id: number; declare content: string; declare note_id: string; declare user_id: string; declare comment_id: string; declare created_at: Date; declare updated_at: Date; static async initModel(sequelize: Sequelize, initOptions?: InitOptions, opts?: SyncOptions) { Comment.init( { id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true, }, content: { type: DataTypes.TEXT, allowNull: false, }, note_id: { type: DataTypes.STRING, allowNull: false, }, user_id: { type: DataTypes.STRING, allowNull: false, }, comment_id: { type: DataTypes.STRING, allowNull: false, }, }, { sequelize, // passing the `sequelize` instance is required modelName: 'Comment', // we need to choose the model name ...initOptions, }, ); await Comment.sync(opts || {}); } }