20260429140000_add_audit_action_index.php 669 B

123456789101112131415161718192021222324252627
  1. <?php
  2. declare(strict_types=1);
  3. use App\Infrastructure\Db\Migrations\BaseMigration;
  4. /**
  5. * SPEC §M12: the audit page filters heavily by `action`. M02's audit_log
  6. * migration covered created_at, (actor_kind, actor_id), and
  7. * (target_type, target_id) but not action — fix here.
  8. */
  9. final class AddAuditActionIndex extends BaseMigration
  10. {
  11. public function up(): void
  12. {
  13. $this->table('audit_log')
  14. ->addIndex(['action'], ['name' => 'idx_audit_action'])
  15. ->update();
  16. }
  17. public function down(): void
  18. {
  19. $this->table('audit_log')
  20. ->removeIndexByName('idx_audit_action')
  21. ->update();
  22. }
  23. }