0023_web_api_keys.up.sql 686 B

123456789101112131415161718
  1. -- Create table for Web API authentication keys
  2. CREATE TABLE IF NOT EXISTS web_api_keys
  3. (
  4. dev_id VARCHAR(255) PRIMARY KEY,
  5. dev_key VARCHAR(255) UNIQUE NOT NULL,
  6. app_name VARCHAR(255) NOT NULL,
  7. created_at INTEGER NOT NULL,
  8. last_used INTEGER,
  9. is_active BOOLEAN DEFAULT 1,
  10. rate_limit INTEGER DEFAULT 60,
  11. allowed_origins TEXT, -- JSON array of allowed CORS origins
  12. capabilities TEXT -- JSON array of enabled features/endpoints
  13. );
  14. -- Create indexes for efficient lookups
  15. CREATE INDEX idx_web_api_keys_dev_key ON web_api_keys(dev_key);
  16. CREATE INDEX idx_web_api_keys_is_active ON web_api_keys(is_active);