-- Tech Stack Specifications Schema
-- Resource requirements per technology for AI-powered server recommendations

CREATE TABLE IF NOT EXISTS tech_specs (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  name TEXT NOT NULL UNIQUE,              -- canonical name: 'nginx', 'nodejs', 'php'
  category TEXT NOT NULL,                 -- 'web_server', 'runtime', 'database', 'cache', 'queue'
  vcpu_per_users INTEGER NOT NULL,        -- 1 vCPU can handle N users
  vcpu_per_users_max INTEGER,             -- range max (optional)
  min_memory_mb INTEGER NOT NULL,         -- minimum RAM in MB
  max_memory_mb INTEGER,                  -- recommended max RAM in MB
  description TEXT,                       -- brief description
  aliases TEXT,                           -- JSON array: ["node", "node.js", "express"]
  is_memory_intensive BOOLEAN DEFAULT 0,  -- JVM, in-memory DB
  is_cpu_intensive BOOLEAN DEFAULT 0,     -- encoding, ML inference
  created_at TEXT DEFAULT (datetime('now')),
  updated_at TEXT DEFAULT (datetime('now'))
);

-- Index for fast lookup
CREATE INDEX IF NOT EXISTS idx_tech_specs_name ON tech_specs(name);
CREATE INDEX IF NOT EXISTS idx_tech_specs_category ON tech_specs(category);
