diff --git a/database/migrations/2026_03_05_180001_create_quality_documents_table.php b/database/migrations/2026_03_05_180001_create_quality_documents_table.php index 3f5fa133..d4bce70d 100644 --- a/database/migrations/2026_03_05_180001_create_quality_documents_table.php +++ b/database/migrations/2026_03_05_180001_create_quality_documents_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasTable('quality_documents')) { + return; + } + Schema::create('quality_documents', function (Blueprint $table) { $table->id(); $table->foreignId('tenant_id')->constrained(); diff --git a/database/migrations/2026_03_05_180002_create_quality_document_orders_table.php b/database/migrations/2026_03_05_180002_create_quality_document_orders_table.php index 2b9e6b22..23d1c7cc 100644 --- a/database/migrations/2026_03_05_180002_create_quality_document_orders_table.php +++ b/database/migrations/2026_03_05_180002_create_quality_document_orders_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasTable('quality_document_orders')) { + return; + } + Schema::create('quality_document_orders', function (Blueprint $table) { $table->id(); $table->foreignId('quality_document_id')->constrained()->cascadeOnDelete(); diff --git a/database/migrations/2026_03_05_180003_create_quality_document_locations_table.php b/database/migrations/2026_03_05_180003_create_quality_document_locations_table.php index a3b8ba05..067a9144 100644 --- a/database/migrations/2026_03_05_180003_create_quality_document_locations_table.php +++ b/database/migrations/2026_03_05_180003_create_quality_document_locations_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasTable('quality_document_locations')) { + return; + } + Schema::create('quality_document_locations', function (Blueprint $table) { $table->id(); $table->foreignId('quality_document_id')->constrained()->cascadeOnDelete(); diff --git a/database/migrations/2026_03_05_180004_create_performance_reports_table.php b/database/migrations/2026_03_05_180004_create_performance_reports_table.php index 860966d0..1660f90d 100644 --- a/database/migrations/2026_03_05_180004_create_performance_reports_table.php +++ b/database/migrations/2026_03_05_180004_create_performance_reports_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasTable('performance_reports')) { + return; + } + Schema::create('performance_reports', function (Blueprint $table) { $table->id(); $table->foreignId('tenant_id')->constrained(); diff --git a/database/migrations/2026_03_06_094425_add_inspection_data_to_quality_document_locations.php b/database/migrations/2026_03_06_094425_add_inspection_data_to_quality_document_locations.php index d3e754ac..781b25f4 100644 --- a/database/migrations/2026_03_06_094425_add_inspection_data_to_quality_document_locations.php +++ b/database/migrations/2026_03_06_094425_add_inspection_data_to_quality_document_locations.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasColumn('quality_document_locations', 'inspection_data')) { + return; + } + Schema::table('quality_document_locations', function (Blueprint $table) { $table->json('inspection_data')->nullable()->after('change_reason')->comment('검사 데이터 JSON'); }); diff --git a/database/migrations/2026_03_06_210000_add_journal_link_to_expense_accounts_table.php b/database/migrations/2026_03_06_210000_add_journal_link_to_expense_accounts_table.php index 5a5c0a6f..e11032b9 100644 --- a/database/migrations/2026_03_06_210000_add_journal_link_to_expense_accounts_table.php +++ b/database/migrations/2026_03_06_210000_add_journal_link_to_expense_accounts_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasColumn('expense_accounts', 'journal_entry_id')) { + return; + } + Schema::table('expense_accounts', function (Blueprint $table) { $table->unsignedBigInteger('journal_entry_id')->nullable()->after('loan_id'); $table->unsignedBigInteger('journal_entry_line_id')->nullable()->after('journal_entry_id'); diff --git a/database/migrations/2026_03_06_212500_add_description_to_document_template_sections.php b/database/migrations/2026_03_06_212500_add_description_to_document_template_sections.php index 50b5e71e..e9d530c0 100644 --- a/database/migrations/2026_03_06_212500_add_description_to_document_template_sections.php +++ b/database/migrations/2026_03_06_212500_add_description_to_document_template_sections.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasColumn('document_template_sections', 'description')) { + return; + } + Schema::table('document_template_sections', function (Blueprint $table) { $table->text('description')->nullable()->after('title')->comment('섹션 설명/안내문'); }); diff --git a/database/migrations/2026_03_06_220000_enhance_account_codes_table.php b/database/migrations/2026_03_06_220000_enhance_account_codes_table.php index f7a689b3..998b5ccf 100644 --- a/database/migrations/2026_03_06_220000_enhance_account_codes_table.php +++ b/database/migrations/2026_03_06_220000_enhance_account_codes_table.php @@ -17,6 +17,10 @@ */ public function up(): void { + if (Schema::hasColumn('account_codes', 'sub_category')) { + return; + } + Schema::table('account_codes', function (Blueprint $table) { $table->string('sub_category', 50)->nullable()->after('category') ->comment('중분류 (current_asset, fixed_asset, selling_admin, cogs 등)'); diff --git a/database/migrations/2026_03_10_100000_add_options_to_quality_document_locations.php b/database/migrations/2026_03_10_100000_add_options_to_quality_document_locations.php index 7f99a242..960af010 100644 --- a/database/migrations/2026_03_10_100000_add_options_to_quality_document_locations.php +++ b/database/migrations/2026_03_10_100000_add_options_to_quality_document_locations.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasColumn('quality_document_locations', 'options')) { + return; + } + Schema::table('quality_document_locations', function (Blueprint $table) { $table->json('options')->nullable()->after('inspection_status')->comment('QMS 심사 확인 등 추가 데이터'); }); diff --git a/database/migrations/2026_03_10_110000_create_audit_checklists_tables.php b/database/migrations/2026_03_10_110000_create_audit_checklists_tables.php index 1c9e3326..c133559e 100644 --- a/database/migrations/2026_03_10_110000_create_audit_checklists_tables.php +++ b/database/migrations/2026_03_10_110000_create_audit_checklists_tables.php @@ -9,6 +9,10 @@ public function up(): void { // 1) 심사 점검표 마스터 + if (Schema::hasTable('audit_checklists')) { + return; + } + Schema::create('audit_checklists', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('tenant_id')->comment('테넌트ID'); diff --git a/database/migrations/2026_03_10_224806_add_tenant_id_to_document_detail_tables.php b/database/migrations/2026_03_10_224806_add_tenant_id_to_document_detail_tables.php index b34858e1..9095e349 100644 --- a/database/migrations/2026_03_10_224806_add_tenant_id_to_document_detail_tables.php +++ b/database/migrations/2026_03_10_224806_add_tenant_id_to_document_detail_tables.php @@ -15,6 +15,10 @@ public function up(): void $tables = ['document_data', 'document_approvals', 'document_attachments']; foreach ($tables as $table) { + if (Schema::hasColumn($table, 'tenant_id')) { + continue; + } + Schema::table($table, function (Blueprint $table) { $table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트 ID'); $table->index('tenant_id'); diff --git a/database/migrations/2026_03_11_100000_add_certificate_file_id_to_receivings_table.php b/database/migrations/2026_03_11_100000_add_certificate_file_id_to_receivings_table.php index 719942bc..cea0ed2f 100644 --- a/database/migrations/2026_03_11_100000_add_certificate_file_id_to_receivings_table.php +++ b/database/migrations/2026_03_11_100000_add_certificate_file_id_to_receivings_table.php @@ -8,6 +8,10 @@ { public function up(): void { + if (Schema::hasColumn('receivings', 'certificate_file_id')) { + return; + } + Schema::table('receivings', function (Blueprint $table) { $table->unsignedBigInteger('certificate_file_id') ->nullable() diff --git a/database/migrations/2026_03_11_174640_create_checklist_templates_table.php b/database/migrations/2026_03_11_174640_create_checklist_templates_table.php index 881f58df..ce6cc61e 100644 --- a/database/migrations/2026_03_11_174640_create_checklist_templates_table.php +++ b/database/migrations/2026_03_11_174640_create_checklist_templates_table.php @@ -9,6 +9,10 @@ { public function up(): void { + if (Schema::hasTable('checklist_templates')) { + return; + } + Schema::create('checklist_templates', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('tenant_id')->comment('테넌트ID'); diff --git a/database/migrations/2026_03_11_213232_alter_files_table_extend_mime_type.php b/database/migrations/2026_03_11_213232_alter_files_table_extend_mime_type.php index d6f807e2..91adcdae 100644 --- a/database/migrations/2026_03_11_213232_alter_files_table_extend_mime_type.php +++ b/database/migrations/2026_03_11_213232_alter_files_table_extend_mime_type.php @@ -11,6 +11,10 @@ */ public function up(): void { + if (! Schema::hasTable('files') || ! Schema::hasColumn('files', 'mime_type')) { + return; + } + Schema::table('files', function (Blueprint $table) { $table->string('mime_type', 150)->change(); }); diff --git a/database/migrations/2026_03_12_120000_add_file_id_to_document_template_sections.php b/database/migrations/2026_03_12_120000_add_file_id_to_document_template_sections.php index 219ecbd4..641e5648 100644 --- a/database/migrations/2026_03_12_120000_add_file_id_to_document_template_sections.php +++ b/database/migrations/2026_03_12_120000_add_file_id_to_document_template_sections.php @@ -9,6 +9,10 @@ { public function up(): void { + if (Schema::hasColumn('document_template_sections', 'file_id')) { + return; + } + Schema::table('document_template_sections', function (Blueprint $table) { $table->unsignedBigInteger('file_id')->nullable()->after('image_path') ->comment('도해 이미지 파일 ID (files 테이블 참조)');