feat: 마이그레이션 추가
- tenant_type 필드 추가 마이그레이션 - 프로젝트 관리 테이블 생성 마이그레이션
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->enum('tenant_type', ['STD', 'TPL', 'HQ'])
|
||||
->default('STD')
|
||||
->after('tenant_st_code')
|
||||
->comment('테넌트 유형: STD=일반, TPL=템플릿, HQ=본사');
|
||||
$table->unsignedBigInteger('template_id')
|
||||
->nullable()
|
||||
->after('tenant_type')
|
||||
->comment('복사된 템플릿 테넌트 ID');
|
||||
|
||||
$table->foreign('template_id')
|
||||
->references('id')
|
||||
->on('tenants')
|
||||
->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('tenants', function (Blueprint $table) {
|
||||
$table->dropForeign(['template_id']);
|
||||
$table->dropColumn(['tenant_type', 'template_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
101
database/migrations/2025_11_27_220000_create_admin_pm_tables.php
Normal file
101
database/migrations/2025_11_27_220000_create_admin_pm_tables.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* 프로젝트 관리 기능을 위한 테이블 생성 (MNG 전용)
|
||||
* - admin_pm_projects: 프로젝트 정의
|
||||
* - admin_pm_tasks: 작업(할일) 관리
|
||||
* - admin_pm_issues: 이슈 관리
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// admin_pm_projects: 프로젝트 테이블
|
||||
Schema::create('admin_pm_projects', function (Blueprint $table) {
|
||||
$table->id()->comment('ID');
|
||||
$table->string('name', 100)->comment('프로젝트 이름');
|
||||
$table->text('description')->nullable()->comment('설명');
|
||||
$table->string('status', 20)->default('active')->comment('상태: active, completed, on_hold');
|
||||
$table->date('start_date')->nullable()->comment('시작일');
|
||||
$table->date('end_date')->nullable()->comment('종료일');
|
||||
$table->foreignId('created_by')->nullable()->comment('생성자 ID');
|
||||
$table->foreignId('updated_by')->nullable()->comment('수정자 ID');
|
||||
$table->foreignId('deleted_by')->nullable()->comment('삭제자 ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 인덱스
|
||||
$table->index('status', 'idx_admin_pm_projects_status');
|
||||
$table->index('name', 'idx_admin_pm_projects_name');
|
||||
});
|
||||
|
||||
// admin_pm_tasks: 작업(할일) 테이블
|
||||
Schema::create('admin_pm_tasks', function (Blueprint $table) {
|
||||
$table->id()->comment('ID');
|
||||
$table->foreignId('project_id')->comment('프로젝트 ID')
|
||||
->constrained('admin_pm_projects')
|
||||
->onDelete('cascade');
|
||||
$table->string('title', 255)->comment('작업 제목');
|
||||
$table->text('description')->nullable()->comment('작업 설명');
|
||||
$table->string('status', 20)->default('todo')->comment('상태: todo, in_progress, done');
|
||||
$table->string('priority', 10)->default('medium')->comment('우선순위: low, medium, high');
|
||||
$table->date('due_date')->nullable()->comment('마감일');
|
||||
$table->unsignedInteger('sort_order')->default(0)->comment('정렬 순서');
|
||||
$table->foreignId('assignee_id')->nullable()->comment('담당자 ID');
|
||||
$table->foreignId('created_by')->nullable()->comment('생성자 ID');
|
||||
$table->foreignId('updated_by')->nullable()->comment('수정자 ID');
|
||||
$table->foreignId('deleted_by')->nullable()->comment('삭제자 ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 인덱스
|
||||
$table->index('project_id', 'idx_admin_pm_tasks_project_id');
|
||||
$table->index('status', 'idx_admin_pm_tasks_status');
|
||||
$table->index('priority', 'idx_admin_pm_tasks_priority');
|
||||
$table->index('due_date', 'idx_admin_pm_tasks_due_date');
|
||||
$table->index('sort_order', 'idx_admin_pm_tasks_sort_order');
|
||||
});
|
||||
|
||||
// admin_pm_issues: 이슈 테이블
|
||||
Schema::create('admin_pm_issues', function (Blueprint $table) {
|
||||
$table->id()->comment('ID');
|
||||
$table->foreignId('project_id')->comment('프로젝트 ID')
|
||||
->constrained('admin_pm_projects')
|
||||
->onDelete('cascade');
|
||||
$table->foreignId('task_id')->nullable()->comment('연결된 작업 ID')
|
||||
->constrained('admin_pm_tasks')
|
||||
->onDelete('set null');
|
||||
$table->string('title', 255)->comment('이슈 제목');
|
||||
$table->text('description')->nullable()->comment('이슈 설명');
|
||||
$table->string('type', 20)->default('bug')->comment('타입: bug, feature, improvement');
|
||||
$table->string('status', 20)->default('open')->comment('상태: open, in_progress, resolved, closed');
|
||||
$table->foreignId('created_by')->nullable()->comment('생성자 ID');
|
||||
$table->foreignId('updated_by')->nullable()->comment('수정자 ID');
|
||||
$table->foreignId('deleted_by')->nullable()->comment('삭제자 ID');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 인덱스
|
||||
$table->index('project_id', 'idx_admin_pm_issues_project_id');
|
||||
$table->index('task_id', 'idx_admin_pm_issues_task_id');
|
||||
$table->index('type', 'idx_admin_pm_issues_type');
|
||||
$table->index('status', 'idx_admin_pm_issues_status');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('admin_pm_issues');
|
||||
Schema::dropIfExists('admin_pm_tasks');
|
||||
Schema::dropIfExists('admin_pm_projects');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user