Switch to postgres & improve performance

This pull request changes the backend database from mysql to postgresql. The primary motivation is that postgres supports recursive CTEs, which make querying tree structures (based on parent_id pointers) possible in a single query.

This PR also takes advantage of the new recursive CTE support by using a slightly-customized acts_as_sane_tree gem. Our customizations live here: https://github.com/CruGlobal/acts_as_sane_tree/tree/global_registry_changes


http://jira.uscm.org/browse/GR-2