-- ******************************************************************
-- 表 kku_oauth_access_tokens 的创建SQL
-- 对应的Model: App\Module\OAuth\Models\OAuthAccessToken
-- 警告: 此文件由系统自动生成，禁止修改！
-- ******************************************************************

CREATE TABLE `kku_oauth_access_tokens` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `client_id` varchar(80) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端ID',
  `user_id` bigint unsigned DEFAULT NULL COMMENT '用户ID',
  `access_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '访问令牌',
  `refresh_token` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `expires_at` timestamp NULL DEFAULT NULL COMMENT '过期时间',
  `scope` json DEFAULT NULL COMMENT '权限范围',
  `revoked` tinyint(1) NOT NULL DEFAULT '0',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `oauth_access_tokens_token_unique` (`access_token`) USING BTREE,
  KEY `oauth_access_tokens_client_id_index` (`client_id`) USING BTREE,
  KEY `oauth_access_tokens_user_id_index` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='OAuth访问令牌表';
