const Sequelize = require("sequelize");

module.exports = (db) => {
  const biz_audit_log = db.define(
    "biz_audit_log",
    {
  
      admin_user_id: {
        type: Sequelize.BIGINT.UNSIGNED,
        allowNull: true,
      },
      biz_user_id: {
        type: Sequelize.BIGINT.UNSIGNED,
        allowNull: true,
      },
      action: {
        type: Sequelize.STRING(64),
        allowNull: false,
      },
      resource_type: {
        type: Sequelize.STRING(64),
        allowNull: false,
        defaultValue: "",
      },
      resource_id: {
        type: Sequelize.BIGINT.UNSIGNED,
        allowNull: true,
      },
      detail: {
        type: Sequelize.JSON,
        allowNull: true,
      },
    },
    {
      tableName: "biz_audit_log",
      timestamps: false,
      underscored: true,
    }
  );
  // biz_audit_log.sync({ alter: true });
  return biz_audit_log;
};
