Skip to content

The WATCH feature

Bernhard Baumrock edited this page Feb 3, 2023 · 3 revisions

RockMigrations comes with a feature to watch files for changes.

What does that mean?

If a watched file is changed, RockMigrations will detect that change and will run the migrations that are defined in that file on the next reload of the page. Not more, not less.

If you have RockFrontend installed, then the changed file will trigger a reload automatically, which will then run all the migrations that are inside the changed file. All other migrations will NOT run!

What does that NOT mean?

It does NOT mean, that RockMigrations watches for changes that you apply via GUI in the ProcessWire backend.

Also, if you don't have any migration instructions in your changed file then nothing will happen (apart from the reload).

How to watch files

You have several options to tell RockMigrations to watch a file for changes:

  • /site/migrate.php will automatically be watched
  • Use $rm->watch("/path/to/your/file"); on init() of a module
  • Let your Custom Page Class use the MagicPage class (see docs in the wiki)
  • Add a migrate file to your module, like /site/modules/YourModule/YourModule.migrate.php

Note that module migrate files (YourModule.migrate.php) are ignored if the corresponding Module is not yet installed!

Clone this wiki locally