module.exports = (sequelize, DataTypes) => { const EstablishmentProduct = sequelize.define("establishment_products", { id: { type: DataTypes.INTEGER, autoIncrement: true, primaryKey: true, }, establishment_id: { type: DataTypes.INTEGER, allowNull: false, }, product_id: { type: DataTypes.INTEGER, allowNull: false, }, is_active: { type: DataTypes.BOOLEAN, defaultValue: true, }, created_at: { type: DataTypes.DATE, defaultValue: DataTypes.NOW, }, created_by: { type: DataTypes.INTEGER, allowNull: false, }, action_done_by: { type: DataTypes.STRING, allowNull: false, }, updated_at: { type: DataTypes.DATE, allowNull: true, }, updated_by: { type: DataTypes.INTEGER, allowNull: true, }, }, { tableName: "establishment_products", timestamps: false, }); EstablishmentProduct.associate = (models) => { EstablishmentProduct.belongsTo(models.Product, { // 'Product' with capital P foreignKey: "product_id", as: "product", }); }; return EstablishmentProduct; };