Switch to DataMapper

Switch from 'pg' and SQL queries to DataMapper.