Fix the migrate-cache script to use proper PDO as well, fixes #1912