fixes + PostgreSQL for Redmine support

Hi, please find attached the pull request consisting from two things:
* Redmine PostgreSQL database support - hash 8d518b0
* required fixes I encountered with recent migration - all other hashes