Skip to content

Add full support to various migration hooks.

Compare
Choose a tag to compare
@chrishalbert chrishalbert released this 20 Jul 22:51
· 61 commits to master since this release
e4fa163

Now, developers can use multiple types of hooks. There are hooks that run before and after migrate and rollback. There are also hooks that run in the constructor and destructor.

One may question why a hook is so beneficial; a developer can just add their own to the method.

Well, this, in combination with the traits, allows you to automatically execute certain types of tasks by default on all of your migrations. For a simple example, perhaps you want turn on query logging and output this for all the migrations. You can create a trait that adds hooks to preMigrate to turn on query logging, and then in postMigrate you output the query logs. You can add that trait in the configs/nomadic.php and then moving forward, all migrations will output the details you are looking for.