api_keys.sql 541 B

12345678910111213
  1. -- 创建 API 密钥表
  2. CREATE TABLE IF NOT EXISTS api_keys (
  3. id INT AUTO_INCREMENT PRIMARY KEY,
  4. api_key VARCHAR(255) NOT NULL UNIQUE,
  5. created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  6. expired_at TIMESTAMP NULL,
  7. is_active BOOLEAN DEFAULT TRUE,
  8. INDEX idx_api_key (api_key),
  9. INDEX idx_is_active (is_active)
  10. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  11. -- 插入一个示例 API 密钥(仅供测试使用)
  12. INSERT IGNORE INTO api_keys (api_key, is_active) VALUES ('sk-test1234567890', TRUE);