Files
sam-api/app/Http/Requests/Audit/TriggerAuditLogIndexRequest.php
권혁성 d07bad16df feat:DB 트리거 기반 데이터 변경 추적 시스템 구현
Phase 1: DB 기반 구축
- trigger_audit_logs 테이블 (RANGE 파티셔닝 15개, 3개 인덱스)
- 789개 MySQL AFTER 트리거 (263 테이블 × INSERT/UPDATE/DELETE)
- SetAuditSessionVariables 미들웨어 (@sam_actor_id, @sam_session_info)

Phase 2: 복구 메커니즘
- TriggerAuditLog 모델, TriggerAuditLogService, AuditRollbackService
- 6개 API 엔드포인트 (index, show, stats, history, rollback-preview, rollback)
- FormRequest 검증 (TriggerAuditLogIndexRequest, TriggerAuditRollbackRequest)

Phase 3: 관리 도구
- v_unified_audit VIEW (APP + TRIGGER 통합, COLLATE 처리)
- audit:partitions 커맨드 (파티션 추가/삭제, dry-run)
- audit:triggers 커맨드 (트리거 재생성, 테이블별/전체)
- 월 1회 파티션 자동 관리 스케줄러 등록

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 09:17:15 +09:00

37 lines
1.0 KiB
PHP

<?php
namespace App\Http\Requests\Audit;
use App\Http\Requests\Traits\HasPagination;
use Illuminate\Foundation\Http\FormRequest;
class TriggerAuditLogIndexRequest extends FormRequest
{
use HasPagination;
protected int $maxSize = 200;
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'page' => 'nullable|integer|min:1',
'size' => 'nullable|integer|min:1',
'table_name' => 'nullable|string|max:64',
'row_id' => 'nullable|string|max:64',
'dml_type' => 'nullable|string|in:INSERT,UPDATE,DELETE',
'tenant_id' => 'nullable|integer|min:1',
'actor_id' => 'nullable|integer|min:1',
'db_user' => 'nullable|string|max:100',
'from' => 'nullable|date',
'to' => 'nullable|date|after_or_equal:from',
'sort' => 'nullable|string|in:created_at,id',
'order' => 'nullable|string|in:asc,desc',
];
}
}