Replace sqlite3 with PostgreSQL