- GraphViz 설치를 통한 ERD 다이어그램 생성 지원 - BelongsToTenantTrait → BelongsToTenant 트레잇명 수정 - Estimate, EstimateItem 모델의 인터페이스 참조 오류 해결 - 60개 모델의 완전한 관계도 생성 (graph.png, 4.1MB) - beyondcode/laravel-er-diagram-generator 패키지 활용 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Database\Events\MigrationsEnded;
|
|
use Illuminate\Support\Facades\Event;
|
|
use Illuminate\Support\Facades\Artisan;
|
|
|
|
class MigrationServiceProvider extends ServiceProvider
|
|
{
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
public function boot()
|
|
{
|
|
// 마이그레이션 완료 후 자동으로 관계 문서 업데이트
|
|
Event::listen(MigrationsEnded::class, function (MigrationsEnded $event) {
|
|
$this->updateRelationshipsAfterMigration();
|
|
});
|
|
}
|
|
|
|
private function updateRelationshipsAfterMigration(): void
|
|
{
|
|
try {
|
|
// 논리적 관계 문서 자동 업데이트
|
|
Artisan::call('db:update-relationships');
|
|
|
|
// Git에 자동 커밋 (선택사항)
|
|
if (config('database.auto_commit_relationships', false)) {
|
|
$this->autoCommitRelationships();
|
|
}
|
|
|
|
\Log::info('✅ 마이그레이션 후 논리적 관계 문서 업데이트 완료');
|
|
|
|
} catch (\Exception $e) {
|
|
\Log::error('❌ 논리적 관계 문서 업데이트 실패: ' . $e->getMessage());
|
|
}
|
|
}
|
|
|
|
private function autoCommitRelationships(): void
|
|
{
|
|
$commands = [
|
|
'git add LOGICAL_RELATIONSHIPS.md',
|
|
'git commit -m "docs: 마이그레이션 후 논리적 관계 자동 업데이트
|
|
|
|
🤖 Generated with [Claude Code](https://claude.ai/code)
|
|
|
|
Co-Authored-By: Claude <noreply@anthropic.com>"'
|
|
];
|
|
|
|
foreach ($commands as $command) {
|
|
exec($command, $output, $returnCode);
|
|
if ($returnCode !== 0) {
|
|
\Log::warning("Git 명령 실행 실패: {$command}");
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} |