Bug 1002685 - Downcase domain names when fetching applications by domain

The domain_id lookup for applications scoped to a domain was not properly
lowercasing the namespace

[merge]