Refactor PostgreSQL connection creation into its own module