| 123456789101112131415161718192021222324252627282930 |
- <?php
- declare(strict_types=1);
- use App\Infrastructure\Db\Migrations\BaseMigration;
- /**
- * The numeric `target_id` is rarely meaningful to a human reader of the
- * audit log. Add a sibling `target_label` column carrying the most
- * descriptive identifier for the entity at the moment the event was
- * recorded (reporter/consumer/policy name, category slug, IP/CIDR text,
- * job name, token prefix). Frozen at write time — renaming the entity
- * later does not rewrite history.
- */
- final class AddAuditTargetLabel extends BaseMigration
- {
- public function up(): void
- {
- $this->table('audit_log')
- ->addColumn('target_label', 'string', ['limit' => 255, 'null' => true, 'after' => 'target_id'])
- ->update();
- }
- public function down(): void
- {
- $this->table('audit_log')
- ->removeColumn('target_label')
- ->update();
- }
- }
|