-- 管理后台用户表

USE pay_bridge;

CREATE TABLE IF NOT EXISTS `admin_user` (
  `id`            BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `username`      VARCHAR(64)  NOT NULL COMMENT '用户名',
  `password_hash` VARCHAR(128) NOT NULL COMMENT 'bcrypt hash',
  `status`        TINYINT      NOT NULL DEFAULT 1 COMMENT '1=启用',
  `created_at`    DATETIME(3)  NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
  `updated_at`    DATETIME(3)  NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_username` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='管理后台用户';

-- 默认管理员账号: admin / admin123
-- bcrypt hash of "admin123" with cost=10
INSERT IGNORE INTO `admin_user` (`username`, `password_hash`, `status`)
VALUES ('admin', '$2a$10$MdQLRo6pwF9SyWCYU4TTneJoQL22PxLV4eGzQ0bxnqUKIFNaEQ1YO', 1);
