Fixed sql in upgrade script