LeshaZ
LeshaZ

Reputation: 689

Is there any way to check if migrations are ended

My question is if there is any way to check if migrations are ended. Maybe some events or hooks or something else.

Upvotes: 2

Views: 265

Answers (1)

Travis Britz
Travis Britz

Reputation: 5552

You may be able to listen for the Illuminate\Console\Events\CommandFinished event to determine when the php artisan migrate command has finished running (by comparing the $command property of the event).

If you want a hook for each migration file, one option is to extend Illuminate\Database\Migrations\Migrator with your own class and override the runUp() method to fire an event afterward. I don't see any obvious built-in hooks for individual migrations, however. A much more simple solution would be to dispatch an event yourself from within each migration's up() method.

Upvotes: 2

Related Questions