I’ve run into an issue when adding an App, then removing it, and later trying to re-add it.
Here are the steps I’ve taken:
- Create a new App.
bench new-app mynewapp
- Added this new App to a site.
bench --site mysite1 install-app mynewapp
- Verify the installation
bench --site mysite1 list-apps
- Next, remove the App we just installed.
bench --site mysite1 remove-from-installed-apps mynewapp
- Verify the removal (this works)
bench --site mysite1 list-apps
- Add the App back again to the site.
bench --site mysite1 install-app mynewapp
And here’s the error:
frappe.exceptions.DuplicateEntryError: (u’Module Def’, u’Mynewapp’, IntegrityError(1062, “Duplicate entry ‘Mynewapp’ for key ‘PRIMARY’”))
Reasoning
It appears Bench is trying to add another row to MariaDB table “tabModule Def”, however the row was previously added during the first App installation.
Suggestion for Fix
- Removing the App should also remove the row from MariaDB.
or - When adding an App, Bench should check if it’s already in the “tabModule Def” table.