-- One table. Run this once against the license service's own database.
CREATE TABLE IF NOT EXISTS deployments (
    id            CHAR(64)     NOT NULL PRIMARY KEY,   -- the activation id (64 hex chars)
    key_b64       TEXT         NOT NULL,                -- the deployment's decryption key, base64
    slug          VARCHAR(100) NOT NULL,                -- client label, for your own reference only
    domain        VARCHAR(255) NULL,                    -- bound on first successful /activate
    status        ENUM('active','revoked') NOT NULL DEFAULT 'active',
    created_at    TIMESTAMP    NOT NULL DEFAULT CURRENT_TIMESTAMP,
    activated_at  TIMESTAMP    NULL,
    last_check_at TIMESTAMP    NULL,
    INDEX idx_slug (slug)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
