[Reviewed] Create a shared earned badges view.

Create an view that connects course memberships to shared earned badges. This is used for the shared badges view in the student dashboard.

To support PostgreSQL views, the ActiveRecord schema format has been changed to SQL. The SQL format will use `pg_dump` and will preserve PostgreSQL specific features, such as views, materialized views, procedures, triggers and foreign keys.

The model for SharedEarnedBadge is nested in the User model. Views will be nested in a suitable model. You'll know it's a view if it is nested.

Performance of the view relative to the join is not a dramatic improvement, since the join was performant, but the view is as fast as it gets, the run time of the shared badges partial is 12-18ms on a development instance. It was 18-30ms with the join.

Closes #478.