Add postgresql support
Merge branch 'convert-to-postgres'