Update the upgrade script from pkgdb1 to pkgdb2 db scheme

- Use flush() instead of commit() to try to save some time
- Keep a list of package we fail to import to PackageListing