SchemaMigrator / ConnectionMigrator calls
ClearCacheService->clearAll(), which in turn
just re-applies ext_localconf.php and ext_tables.php,
which in turn could re-apply hooks which have been
registered via
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = MyHook::class;
Thus, for such cases, it is important the ext_localconf.php
is not loaded again.
clearAll() now has an optional argument, to flush caches
(due to configuration changes, or with DB upgrade in place) so
they are completely emptied
This is less "brutal" than the original "clearAll" method, as it does
not re-load TYPO3_CONF_VARS.
This problem comes from https://review.typo3.org/c/Packages/TYPO3.CMS/+/76553/20/typo3/sysext/core/Classes/Database/Schema/SchemaMigrator.php
The solution can be found in the now corrected test in EXT:webhooks,
which actually registers a hook like this.