Fixed
Project:
Simple favourites
Version:
2.0.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Jul 2026 at 09:23 UTC
Updated:
14 Jul 2026 at 21:34 UTC
Jump to comment: Most recent
The module declares simple_favs_user and simple_favs_user_other in hook_schema(). Drupal creates tables declared by hook_schema() during module installation. The module then tries to create the same tables again in hook_install(), causing installation to fail with
"Table 'simple_favs_user' already exists."
1. Install Drupal 11.4.
2. Add simple_favs under modules/contrib.
3. Run: drush en -y simple_favs
Remove the manual createTable() calls from hook_install(). Keep only the
non-schema install work there:
function simple_favs_install() {
_simple_favs_import_translation('fr');
}
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
dkmishra commentedComment #4
joseph.olstadMerge request is wrong. the install should first check to see if the tables already exist and put those two functions inside the condition where the tables do not exist.
Alternatively someone could put a hook uninstall to remove the tables during the uninstall however prefer adding the check to see if the tables do not exist yet.
Comment #5
dkmishra commentedThanks for the feedback, @joseph.olstad. Updated MR !8 — hook_install() now checks tableExists() before calling createTable() for both simple_favs_user and simple_favs_user_other, rather than removing the calls outright. This keeps the manual creation as a defensive fallback for any install path that doesn't go through the normal hook_schema() flow, while still fixing the "table already exists" fatal on the standard drush en install.
Tested locally with drush pm:uninstall simple_favs -y followed by drush en simple_favs -y — installs cleanly now.
Moving back to "Needs review."
Comment #7
joseph.olstadThanks
Comment #9
joseph.olstadhttps://www.drupal.org/project/simple_favs/releases/2.0.12