Replace sqlite3 with Postgresql