ric2016/openstreetmap_hooked

Hooks module (v3) crashes module admin when InnoDB is available but webtrees still uses myIsam for the modules table

Closed this issue · 2 comments

This issue is with the Hooks module, which you obtain from a third party. You might therefor not be inclined to change the code for it, but you may want to document the behaviour I describe, and a workaround for it.

My webtrees (1.7.9) still uses MyISAM as database engine, since it was first installed as version 1.2.6.

On my localhost installation, I have even disabled InnoDB, because of other tools that work better with MyISAM. As a consequence, the ENGINE=InnoDB instruction in ./modules_v3/hooks_repackaged/Module/Hooks/Schema/Migration0.php is ignored, and in turn the MyISAM engine ignores the FOREIGN KEY instruction (reduces it to just another index). Therefor installing the Hooks module for openstreetmap_hooked runs fine on that localhost.

On my public webserver installation however, that also still uses the old MyISAM tables, I can not disable the InnoDB engine, and the maj_hooks table is in effect created as an InnoDB table. But a FOREIGN KEY restriction requires exact equality of the 2 keys involved, including the database engine for their respective tables. This causes an error when Migration0.php is first executed, from the module administration code :

SQLSTATE[HY000]: General error: 1005 Can't create table webtrees.webtr_maj_hooks (errno: 150 "Foreign key constraint is incorrectly formed")

Workaround
Replace the database engine in ./modules_v3/hooks_repackaged/Module/Hooks/Schema/Migration0.php with ENGINE=MyISAM

I guess this potentially affects other tables as well, as other Migration scripts (main webtrees, also the Google Maps module) use explicit database engine definitions as well.

Good news: In webtrees 2.x, this is no longer the case. Also, the Hooks module is no longer required in 2.x anyway, which simplifies the setup in general.

For 1.x, I'll add a note to the hooks module, as suggested.

Note added in the latest release.