Docker: How to remove all manifests without any tags assigned (with groovy or tasks)?

Sonatype Nexus Repository
COMMUNITY 3.77.2-02

I am trying to remove all manifests and their related blobs, that have no docker tag assigned. I.e. when I delete a tag in the browse UI, I would like to remove it’s associated manifest too.

I tried using groovy scripts for that, but there seems to be no documentation or even working examples for listing manifests or blobs when using SQL database. All I found seems to be using OrientDB, but these do not work using SQL.

Also, pages that supposedly explained the differences are down: https://help.sonatype.com/en/feature-availability-for-postgresql-and-h2-databases.html

So, how do I iterate over all manifests and check if they have any tags assigned and remove the ones without tags?

Can anyone provide working groovy script (not with orientDB but with postgreSQL), that just lists all docker manifests and their properties to get me started?

Thanks a lot!