feat: 트리거 감사로그 operation_id 컬럼 추가 및 요청별 UUID 설정

- trigger_audit_logs 테이블에 operation_id(VARCHAR 36) 컬럼 추가
- ix_trig_operation 인덱스 생성 (일괄 롤백 조회용)
- SetAuditSessionVariables 미들웨어에서 요청마다 @sam_operation_id UUID 설정

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 11:17:41 +09:00
parent cc5fe61fcd
commit 6ac3f0c860
3 changed files with 33 additions and 1 deletions

View File

@@ -5,12 +5,16 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use Symfony\Component\HttpFoundation\Response;
class SetAuditSessionVariables
{
public function handle(Request $request, Closure $next): Response
{
// 요청 단위 operation_id (인증 여부와 무관하게 항상 설정)
DB::statement('SET @sam_operation_id = ?', [Str::uuid()->toString()]);
if (auth()->check()) {
DB::statement('SET @sam_actor_id = ?', [auth()->id()]);
DB::statement('SET @sam_session_info = ?', [