Skip to content

Commit

Permalink
feat: add configMigrations() method to temporarily enable/disable con…
Browse files Browse the repository at this point in the history
…fig migrations
BernhardBaumrock committed Jan 13, 2025
1 parent cb6d678 commit 10702f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions RockMigrations.module.php
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 10702f3

Please sign in to comment.