Check whether ConnectionAdapter constants are defined before trying to
use them so that the environment works in both PostgreSQL and MySQL.
Fixed typo in down method of migration (wrong table name).
When creating views in migrations, cast the result_type column in a
database-agnostic way so that the migrations work with both MySQL and
PostgreSQL.