Fixing missing query in upgrade script