Instance-level databases like coolify-db (with id = 0) should always be assigned to the root team (id = 0) rather than attempting to resolve their team from the database object itself.