Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

chore: drop the activity command cleanup migration

Andras Bacsaia7dee08cdddb
diff --git a/database/migrations/2026_09_28_093936_remove_stored_commands_from_finished_activities.php b/database/migrations/2026_09_28_093936_remove_stored_commands_from_finished_activities.php
deleted file mode 100644
index cfd1008f9c..0000000000
--- a/database/migrations/2026_09_28_093936_remove_stored_commands_from_finished_activities.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-use App\Enums\ProcessStatus;
-use App\Support\RemoteProcessCommand;
-use Illuminate\Database\Migrations\Migration;
-use Spatie\Activitylog\Models\Activity;
-
-return new class extends Migration
-{
- /**
- * Remove the stored command from remote process activities that no longer run.
- *
- * Before this release the command was stored as plain text and kept for 60 days. It can
- * contain secrets such as database passwords, S3 keys and tunnel tokens. Queued or running
- * tasks keep their command, because the queue worker still reads it; the task removes it
- * itself when it ends. Queued or running rows older than one day are stuck and are cleaned too.
- */
- public function up(): void
- {
- Activity::query()
- ->whereNotNull('properties->'.RemoteProcessCommand::PROPERTY)
- ->where(fn ($query) => $query
- ->whereNotIn('properties->status', [ProcessStatus::QUEUED->value, ProcessStatus::IN_PROGRESS->value])
- ->orWhereNull('properties->status')
- ->orWhere('updated_at', '<', now()->subDay()))
- ->chunkById(500, function ($activities) {
- foreach ($activities as $activity) {
- $activity->properties = $activity->properties->except([
- RemoteProcessCommand::PROPERTY,
- RemoteProcessCommand::ENCRYPTED_PROPERTY,
- ]);
- $activity->saveQuietly();
- }
- });
- }
-
- public function down(): void
- {
- // The removed commands cannot be restored.
- }
-};
diff --git a/tests/Feature/RemoveStoredActivityCommandsMigrationTest.php b/tests/Feature/RemoveStoredActivityCommandsMigrationTest.php
deleted file mode 100644
index 118899f711..0000000000
--- a/tests/Feature/RemoveStoredActivityCommandsMigrationTest.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-
-use App\Enums\ProcessStatus;
-use Carbon\CarbonInterface;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Spatie\Activitylog\Models\Activity;
-
-uses(RefreshDatabase::class);
-
-function storedCommandActivity(string $status, ?CarbonInterface $updatedAt = null): Activity
-{
- $activity = activity()
- ->withProperties(['command' => 'echo POSTGRES_PASSWORD=secret', 'type' => 'inline', 'status' => $status, 'server_uuid' => 'server'])
- ->event('inline')
- ->log('[]');
-
- if ($updatedAt !== null) {
- Activity::query()->whereKey($activity->id)->toBase()->update(['updated_at' => $updatedAt]);
- }
-
- return $activity;
-}
-
-it('removes stored commands from activities that no longer run', function () {
- $finished = storedCommandActivity(ProcessStatus::FINISHED->value);
- $failed = storedCommandActivity(ProcessStatus::ERROR->value);
- $running = storedCommandActivity(ProcessStatus::IN_PROGRESS->value);
- $queued = storedCommandActivity(ProcessStatus::QUEUED->value);
- $stuck = storedCommandActivity(ProcessStatus::IN_PROGRESS->value, now()->subDays(2));
-
- (require database_path('migrations/2026_09_28_093936_remove_stored_commands_from_finished_activities.php'))->up();
-
- $command = fn (Activity $activity) => Activity::query()->findOrFail($activity->id)->getExtraProperty('command');
- expect($command($finished))->toBeNull()
- ->and($command($failed))->toBeNull()
- ->and($command($stuck))->toBeNull()
- ->and($command($running))->toBe('echo POSTGRES_PASSWORD=secret')
- ->and($command($queued))->toBe('echo POSTGRES_PASSWORD=secret')
- ->and(Activity::query()->findOrFail($finished->id)->getExtraProperty('status'))->toBe(ProcessStatus::FINISHED->value);
-});