--
-- Host: localhost    Database: eduSign
-- ------------------------------------------------------

set autocommit=0;
commit;

--
-- Table structure for table `t_login_log`
--

CREATE TABLE `t_login_log` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT,
  `uid` varchar(100) NOT NULL COMMENT '使用者帳號',
  `user_type` enum('admin','teacher','student','guest') NOT NULL COMMENT '使用者類型',
  `login_method` enum('ldap','google','google_guest','database','guest') NOT NULL,
  `login_time` datetime DEFAULT current_timestamp() COMMENT '登入時間',
  `ip_address` varchar(45) DEFAULT NULL COMMENT 'IP位址(支援IPv6)',
  `user_agent` varchar(500) DEFAULT NULL COMMENT '瀏覽器資訊',
  `status` enum('success','failed') NOT NULL COMMENT '登入狀態',
  `fail_reason` varchar(255) DEFAULT NULL COMMENT '失敗原因',
  PRIMARY KEY (`id`),
  KEY `idx_uid` (`uid`),
  KEY `idx_login_time` (`login_time`),
  KEY `idx_user_type` (`user_type`),
  KEY `idx_status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='登入記錄表';

--
-- Dumping data for table `t_login_log`
--

set autocommit=0;
INSERT INTO `t_login_log` VALUES
(1,'yangmc','teacher','ldap','2025-12-26 20:21:11','10.32.144.47','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36','success',NULL),
(2,'yangmc','teacher','ldap','2025-12-26 20:22:00','10.32.144.47','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36','success',NULL);
commit;


