Unable to drop database role in SQL Server

I just ran into an issue where I was unable to delete a database role, somehow my custom database role had become the owner of the db_datareader role.

Deletion of the role was not possible due to the following error:

Error: 15138 The database principal owns a schema in the database, and cannot be dropped.

The solution is straightforward:

First find out which schema is being owned by the rolename:

SELECT name FROM sys.schemas WHERE principal_id = USER_ID( ‘<rolename here>‘ )

Then change ownership using:

ALTER AUTHORIZATION ON SCHEMA::<schemaname here> TO dbo

After which you can drop the role

DROP ROLE <rolename here>