Skip to content

Commit

Permalink
feat: add hookable method migrationsDone
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Mar 15, 2023
1 parent e9f2cde commit 907e0ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions RockMigrations.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2753,6 +2753,13 @@ public function migrateWatchfiles($force = false)
$this->migrate($migrate);
}
}

$this->log("Triggering RockMigrations::migrationsDone");
$this->migrationsDone();
}

public function ___migrationsDone()
{
}

/**
Expand Down
13 changes: 13 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ $config->noMigrate = true;

This prevents running migrations but files will still be watched for changes and you will still be able to trigger migrations from the CLI.

### Hooking after migrationsDone

If you want to apply migrations after all other migrations have run, you can hook after `migrationsDone`:

```php
$wire->addHookAfter("RockMigrations::migrationsDone", function(HookEvent $event) {
/** @var RockMigrations $rm */
$rm = $event->object;
$rm->removeFieldFromTemplate('title', 'field-profilephoto');
$rm->removeFieldFromTemplate('title', 'field-pressphoto');
});
```

## Files On Demand

You can instruct RockMigrations to download files on demand from a remote server. This makes it possible to create content on the remote system (eg on the live server), pull data from the database to your local machine and as soon as you open a page RockMigrations will fetch the missing files from your remote server.
Expand Down

0 comments on commit 907e0ba

Please sign in to comment.