-- Real VPS Benchmark data schema
-- Source: LowEndTalk community (Geekbench 5/6 results)

CREATE TABLE IF NOT EXISTS vps_benchmarks (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    provider_name TEXT NOT NULL,
    plan_name TEXT NOT NULL,
    cpu_type TEXT, -- AMD, Intel
    vcpu INTEGER,
    memory_gb INTEGER,
    country_code TEXT,
    geekbench_single INTEGER,
    geekbench_multi INTEGER,
    geekbench_total INTEGER,
    monthly_price_usd REAL,
    performance_per_dollar REAL,
    geekbench_version TEXT,
    benchmark_url TEXT,
    created_at TEXT DEFAULT CURRENT_TIMESTAMP
);

-- Unique constraint for deduplication (used by ON CONFLICT in scraper)
CREATE UNIQUE INDEX IF NOT EXISTS idx_vps_benchmarks_unique
ON vps_benchmarks(provider_name, plan_name, COALESCE(country_code, ''));

-- Index for efficient queries
CREATE INDEX IF NOT EXISTS idx_vps_benchmarks_provider ON vps_benchmarks(provider_name);
CREATE INDEX IF NOT EXISTS idx_vps_benchmarks_vcpu ON vps_benchmarks(vcpu);
CREATE INDEX IF NOT EXISTS idx_vps_benchmarks_price ON vps_benchmarks(monthly_price_usd);
CREATE INDEX IF NOT EXISTS idx_vps_benchmarks_single ON vps_benchmarks(geekbench_single);
