Replace sqlite3 with postgresql