feat:AI 음성녹음 테이블 마이그레이션 및 모델 추가

- ai_voice_recordings 테이블 마이그레이션 생성
- AiVoiceRecording 모델 추가 (Tenants 네임스페이스)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-07 12:52:28 +09:00
parent f45f91967f
commit b9137c93b0
3 changed files with 89 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
# 논리적 데이터베이스 관계 문서
> **자동 생성**: 2026-02-07 01:10:55
> **자동 생성**: 2026-02-07 09:56:46
> **소스**: Eloquent 모델 관계 분석
## 📊 모델별 관계 현황
@@ -499,8 +499,6 @@ ### orders
- **item()**: belongsTo → `items`
- **sale()**: belongsTo → `sales`
- **items()**: hasMany → `order_items`
- **nodes()**: hasMany → `order_nodes`
- **rootNodes()**: hasMany → `order_nodes`
- **histories()**: hasMany → `order_histories`
- **versions()**: hasMany → `order_versions`
- **workOrders()**: hasMany → `work_orders`
@@ -516,7 +514,6 @@ ### order_items
**모델**: `App\Models\Orders\OrderItem`
- **order()**: belongsTo → `orders`
- **node()**: belongsTo → `order_nodes`
- **item()**: belongsTo → `items`
- **quote()**: belongsTo → `quotes`
- **quoteItem()**: belongsTo → `quote_items`
@@ -527,14 +524,6 @@ ### order_item_components
- **orderItem()**: belongsTo → `order_items`
### order_nodes
**모델**: `App\Models\Orders\OrderNode`
- **parent()**: belongsTo → `order_nodes`
- **order()**: belongsTo → `orders`
- **children()**: hasMany → `order_nodes`
- **items()**: hasMany → `order_items`
### order_versions
**모델**: `App\Models\Orders\OrderVersion`
@@ -608,7 +597,6 @@ ### work_orders
- **primaryAssignee()**: hasMany → `work_order_assignees`
- **items()**: hasMany → `work_order_items`
- **issues()**: hasMany → `work_order_issues`
- **stepProgress()**: hasMany → `work_order_step_progress`
- **shipments()**: hasMany → `shipments`
- **bendingDetail()**: hasOne → `work_order_bending_details`
@@ -636,14 +624,6 @@ ### work_order_items
- **workOrder()**: belongsTo → `work_orders`
- **item()**: belongsTo → `items`
### work_order_step_progress
**모델**: `App\Models\Production\WorkOrderStepProgress`
- **workOrder()**: belongsTo → `work_orders`
- **processStep()**: belongsTo → `process_steps`
- **workOrderItem()**: belongsTo → `work_order_items`
- **completedByUser()**: belongsTo → `users`
### work_results
**모델**: `App\Models\Production\WorkResult`
@@ -777,6 +757,11 @@ ### ai_reports
- **creator()**: belongsTo → `users`
### ai_token_usages
**모델**: `App\Models\Tenants\AiTokenUsage`
- **creator()**: belongsTo → `users`
### approvals
**모델**: `App\Models\Tenants\Approval`

View File

@@ -0,0 +1,46 @@
<?php
namespace App\Models\Tenants;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class AiVoiceRecording extends Model
{
use SoftDeletes;
protected $table = 'ai_voice_recordings';
protected $fillable = [
'tenant_id',
'user_id',
'title',
'interview_template_id',
'audio_file_path',
'audio_gcs_uri',
'transcript_text',
'analysis_text',
'status',
'duration_seconds',
'file_expiry_date',
];
protected $casts = [
'duration_seconds' => 'integer',
'file_expiry_date' => 'datetime',
];
public const STATUS_PENDING = 'PENDING';
public const STATUS_PROCESSING = 'PROCESSING';
public const STATUS_COMPLETED = 'COMPLETED';
public const STATUS_FAILED = 'FAILED';
public function user(): BelongsTo
{
return $this->belongsTo(\App\Models\Members\User::class);
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('ai_voice_recordings', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
$table->unsignedBigInteger('user_id')->comment('작성자 ID');
$table->string('title', 200)->comment('녹음 제목');
$table->unsignedBigInteger('interview_template_id')->nullable()->comment('연결된 인터뷰 템플릿 ID');
$table->string('audio_file_path', 500)->nullable()->comment('GCS 오브젝트 경로');
$table->string('audio_gcs_uri', 500)->nullable()->comment('GCS URI (gs://...)');
$table->longText('transcript_text')->nullable()->comment('STT 변환 텍스트');
$table->longText('analysis_text')->nullable()->comment('Gemini AI 분석 결과');
$table->string('status', 20)->default('PENDING')->comment('상태: PENDING, PROCESSING, COMPLETED, FAILED');
$table->unsignedInteger('duration_seconds')->nullable()->comment('녹음 시간(초)');
$table->timestamp('file_expiry_date')->nullable()->comment('파일 삭제 예정일');
$table->timestamps();
$table->softDeletes();
$table->index('tenant_id');
$table->index('user_id');
$table->index('status');
});
}
public function down(): void
{
Schema::dropIfExists('ai_voice_recordings');
}
};