Google News
logo
FuelPHP - Interview Questions
What is Prepping a migration in FuelPHP?
Optionally, a migration class can contain before() and/or after() methods, that can be used for prepping, validation or cleanup functionality. If you have generic functionality, you could create a migration base class for your migrations containing these methods, so you don't have to duplicate code in every migration.
 
Like with the up() method, the before() and after() methods can return false to signal a failure. This can be useful if your migration has generic external dependencies, or perhaps additional validation steps. When it does, the migration will be skipped, and ultimately aborted if a retry fails too. In the case of the after() method returning false, the migration will be reverted by calling the reverse migration method (i.e. calling down() when on an up() migration, and vice-versa).
Advertisement