/* eslint-disable */
'use strict';

module.exports = {
  up: async (queryInterface, Sequelize) => {
    await queryInterface.createTable("audit_logs", {
      "id": { type: Sequelize.BIGINT, allowNull: false, primaryKey: true, autoIncrement: true },
      "admin_id": { type: Sequelize.BIGINT },
      "action": { type: Sequelize.STRING(120), allowNull: false },
      "entity_type": { type: Sequelize.STRING(80), allowNull: false },
      "entity_id": { type: Sequelize.STRING(120) },
      "status_code": { type: Sequelize.INTEGER },
      "ip": { type: Sequelize.STRING(60) },
      "user_agent": { type: Sequelize.STRING(255) },
      "request_body": { type: Sequelize.JSON },
      "request_params": { type: Sequelize.JSON },
      "request_query": { type: Sequelize.JSON },
      "duration_ms": { type: Sequelize.INTEGER },
      "created_at": { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW },
      "updated_at": { type: Sequelize.DATE, allowNull: false, defaultValue: Sequelize.NOW }
    }, {
      charset: 'utf8mb4',
      collate: 'utf8mb4_unicode_ci',
      engine: 'InnoDB',
    });
  },

  down: async (queryInterface) => {
    await queryInterface.dropTable("audit_logs");
  },
};
