Move from mysql to postgres

Change db calls to work with postgres.