timokoerber/laravel-one-time-operations
php artisan migrate. This reduces cognitive overhead and aligns with established workflows.deployed event or manual trigger), ensuring consistency with CI/CD pipelines. This is ideal for post-deployment data transformations, schema adjustments, or feature-specific setup.one_time_operations), preventing duplicate runs—a critical requirement for reliability in production.operations:make, operations:run) for developer workflows, reducing manual intervention.Deployed event) or manual execution via php artisan operations:run. Flexible for both automated and on-demand use cases.one_time_operations), which must be version-controlled alongside migrations. Risk of schema drift if not managed carefully.OneTimeOperation service or using database transactions may be necessary.deployed event align with the pipeline’s post-deployment hooks, or will manual execution (operations:run) be required?deployed event or post-deploy scripts.seeds()) into dedicated operation classes.php artisan operations:run to post-deploy scripts or listen to the deployed event in AppServiceProvider.// app/Providers/AppServiceProvider.php
public function boot()
{
event(new \Timokoerber\OneTimeOperations\Events\Deployed);
}
// app/Providers/AppServiceProvider.php
\Timokoerber\OneTimeOperations\OneTimeOperation::failed(function ($operation) {
\Log::error("Operation failed: {$operation->name}", ['exception' => $operation->exception]);
// Send alert (e.g., Slack, PagerDuty)
});
FeatureXPostDeploy, DatabaseSchemaFix2024).composer require timokoerber/laravel-one-time-operations
php artisan migrate
config/one-time-operations.php.php artisan operations:make UpdateUserProfilesForFeatureY
OneTimeOperation service or using a test database.completed/ directory) to avoid clutter.one_time_operations table must be version-controlled. Use migrations to add columns (e.g., status, metadata) if custom tracking is needed.Schema::table('one_time_operations', function (Blueprint $table) {
$table->json('context')->nullable();
});
deployed event is fired or operations:run is called.one_time_operations table exists and is writable.\Timokoerber\OneTimeOperations\OneTimeOperation::running(function ($operation) {
\Log::info("Running operation: {$operation->name}");
});
php artisan operations:list to inspect pending operations.// In your operation class
dispatch(new ProcessDataJob($data));
How can I help you explore Laravel packages today?