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:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// 파티셔닝된 테이블에 컬럼 추가
|
||||
DB::statement("
|
||||
ALTER TABLE trigger_audit_logs
|
||||
ADD COLUMN operation_id VARCHAR(36) DEFAULT NULL COMMENT '작업 단위 ID (요청별 UUID)' AFTER session_info
|
||||
");
|
||||
|
||||
// operation_id 인덱스 (일괄 롤백 조회용)
|
||||
DB::statement("
|
||||
CREATE INDEX ix_trig_operation
|
||||
ON trigger_audit_logs (operation_id, created_at)
|
||||
");
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('DROP INDEX ix_trig_operation ON trigger_audit_logs');
|
||||
DB::statement('ALTER TABLE trigger_audit_logs DROP COLUMN operation_id');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user