-- =============================================
-- SQL Script untuk membuat tabel log_history
-- Database: sipracika
-- =============================================

-- Hapus tabel jika sudah ada (untuk testing, hati-hati di production)
-- DROP TABLE IF EXISTS `log_history`;

-- =============================================
-- Tabel: log_history
-- =============================================
CREATE TABLE IF NOT EXISTS `log_history` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `user_id` BIGINT UNSIGNED NOT NULL,
  `user_name` VARCHAR(255) NOT NULL,
  `role_id` BIGINT UNSIGNED NOT NULL,
  `role_name` VARCHAR(255) NOT NULL,
  `activity` VARCHAR(255) NOT NULL,
  `menu_name` VARCHAR(255) NOT NULL,
  `created_at` TIMESTAMP NULL DEFAULT NULL,
  `updated_at` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_role_id` (`role_id`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_menu_name` (`menu_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

