#6518·knex

How to use `LifecycleHook` in practice

Author: jvoidsCreated Aug 23, 2026Updated Aug 25, 2026

Hi guys.

There're defined LifecycleHook and MigratorConfigWithLifecycleHooks over here

Could you share examples for how could it be used and at what level. Is it supposed for imported api usage. Or how to use this on cli level as looks similar option is not exposed to it. Could one instantiate knex instance with hooks provided and point it over --knexpath to cli flow. Or what would be the solution. As well how to configure hooks for knex instance it self as it accepts MigratorConfig not the MigratorConfigWithLifecycleHooks .

Thank you.