Closed bfadamm closed 1 year ago
We don't offer down migrations for any of our package, as we think migration down is bad practice.
If you want it, add it to your own project 👍
We don't offer down migrations for any of our package, as we think migration down is bad practice.
If you want it, add it to your own project 👍
I'm quite surprised by this response, have you written a blog post to explain why you believe this?
Description:
I've discovered an issue with one of the migrations published by the package in our Laravel application. The migration is missing a "down" function, which is causing problems when running
php artisan migrate:rollback
as the table persists after rolling back and subsequently causes failures when runningphp artisan migrate
again.Steps to reproduce:
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-migrations"
php artisan migrate
to apply the package's migrations.php artisan migrate:rollback
to rollback the migrations.php artisan migrate
again, which results in an error.Expected behavior:
When running
php artisan migrate:rollback
, the migration should have a "down" function to reverse its effects and properly remove the created table from the database. This would allowphp artisan migrate
to run again without errors.Actual behavior:
The migration is missing a "down" function, causing the table to persist after rolling back, and subsequent migrations to fail.
Environment:
Additional context:
Please consider adding a "down" function in the migration to properly handle rollbacks and avoid conflicts with other migrations. The "down" function should include the necessary schema operations to drop the table created by the migration.
Example of a "down" function: