CREATE TABLE IF NOT EXISTS xbp_docker_containers (
    docker_container_row_id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
    project_id uuid REFERENCES xbp_projects(project_id) ON DELETE SET NULL,
    container_id text NOT NULL,
    container_name text,
    status text,
    ports text,
    inspected_at timestamptz NOT NULL,
    metadata jsonb NOT NULL DEFAULT '{}'::jsonb,
    created_at timestamptz NOT NULL DEFAULT now(),
    updated_at timestamptz NOT NULL DEFAULT now(),
    UNIQUE (container_id)
);

CREATE INDEX IF NOT EXISTS idx_xbp_docker_containers_project_id ON xbp_docker_containers (project_id);
CREATE INDEX IF NOT EXISTS idx_xbp_docker_containers_container_id ON xbp_docker_containers (container_id);
