diff --git a/RockMigrations.module.php b/RockMigrations.module.php index 452a6fe..da55199 100644 --- a/RockMigrations.module.php +++ b/RockMigrations.module.php @@ -659,6 +659,7 @@ public function basename($file) protected function beforeModuleInstall(HookEvent $event): void { + if (wire()->config->noConfigMigrations) return; $moduleName = $event->arguments(0); $moduleDir = dirname(wire()->modules->getModuleFile($moduleName)); $migrationsDir = $moduleDir . '/RockMigrations'; @@ -743,6 +744,20 @@ public function columnWidth(InputfieldWrapper $form, array $fields) } } + /** + * Enable/disable config migrations temporarily + * + * This is helpful when installing dependencies causes an endless loop. To + * fix this you can call configMigrations(false) before installing the + * dependency and configMigrations(true) after installing the dependency. + * + * @return void + */ + public function configMigrations(bool $enable): void + { + wire()->config->noConfigMigrations = !$enable; + } + /** * Thx Adrian * https://github.com/adrianbj/ProcessAdminActions/blob/master/actions/CopyRepeaterItemsToOtherPage.action.php