pub async fn first_patch_for_version(
        &mut self,
        version_id: ProtocolVersionId,
    ) -> DalResult<Option<VersionPatch>> {
        let row = sqlx::query!(
            r#"
            SELECT
                patch
            FROM
                protocol_patches
            WHERE
                minor = $1
            ORDER BY
                patch
            LIMIT
                1
            "#,
            version_id as i32,
        )
        .instrument("first_patch_for_version")
        .fetch_optional(self.storage)
        .await?;
        Ok(row.map(|row| VersionPatch(row.patch as u32)))
    }
Returns first patch number for the minor version.
Note, that some patch numbers can be skipped, so the result is not always 0.
core/lib/dal/src/protocol_versions_dal.rs