Change from couchdb to postgres