CREATE TABLE peer_checks (
    peer_id UUID NOT NULL,
    id UUID DEFAULT gen_random_uuid(),

    check_name STRING NOT NULL,
    check_time INT NOT NULL,
    check_status STRING check (
        check_status = 'unknown' or
        check_status = 'okay' or
        check_status = 'failed'
    ) NOT NULL,
    check_message STRING NOT NULL,
    delete BOOL NOT NULL,

    UNIQUE(peer_id, check_name),
    PRIMARY KEY (peer_id, id),
    CONSTRAINT fk_peer FOREIGN KEY (peer_id) REFERENCES peers (id) ON DELETE CASCADE
) INTERLEAVE IN PARENT peers (peer_id);
