CREATE TABLE IF NOT EXISTS licenses (
    id            INTEGER PRIMARY KEY AUTOINCREMENT,
    payment_id    TEXT NOT NULL UNIQUE,
    hwid          TEXT NOT NULL,
    device_count  INTEGER NOT NULL DEFAULT 1,
    max_devices   INTEGER,
    expires_at    TEXT,
    created_at    TEXT NOT NULL,
    updated_at    TEXT NOT NULL
);

CREATE INDEX IF NOT EXISTS idx_licenses_payment_id ON licenses(payment_id);
CREATE INDEX IF NOT EXISTS idx_licenses_hwid ON licenses(hwid);
