From bc365ebb4de099954f91badd23831809522b1494 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Mon, 22 Jun 2026 11:14:12 +0700 Subject: [PATCH] refactor: standardize migration schema structures and remove redundant approval and status modifications --- BEST_PRACTICE.md | 87 +++++++++++++++++++ .../0001_01_01_000000_create_users_table.php | 2 +- ..._120002_create_cash_transactions_table.php | 2 +- ..._160001_create_employee_advances_table.php | 16 ++-- ...6_06_10_170001_create_rejections_table.php | 3 +- ...11_100001_create_payroll_periods_table.php | 4 +- ...026_06_11_100002_create_payrolls_table.php | 3 +- ...00003_create_payroll_adjustments_table.php | 5 +- ..._11_120000_create_leave_requests_table.php | 3 +- .../2026_06_12_100001_create_orders_table.php | 6 +- ...026_06_12_110001_create_cuttings_table.php | 5 +- ..._110002_create_cutting_materials_table.php | 3 +- ...12_110003_create_cutting_results_table.php | 3 +- ...ndance_id_to_payroll_adjustments_table.php | 23 ----- ...add_approval_columns_to_products_table.php | 35 -------- ...0_create_homepage_configurations_table.php | 4 +- ...pport_to_cutting_materials_and_results.php | 36 -------- ...p_approval_columns_from_products_table.php | 29 ------- ...a_modal_to_cutting_result_prices_table.php | 23 ----- ...140243_add_harga_modal_to_orders_table.php | 23 ----- ...dd_harga_modal_to_product_prices_table.php | 23 ----- ..._verification_status_to_cuttings_table.php | 23 ----- ..._add_submitted_by_id_to_cuttings_table.php | 26 ------ 23 files changed, 118 insertions(+), 269 deletions(-) delete mode 100644 database/migrations/2026_06_18_100006_add_attendance_id_to_payroll_adjustments_table.php delete mode 100644 database/migrations/2026_06_19_100001_add_approval_columns_to_products_table.php delete mode 100644 database/migrations/2026_06_21_030000_add_draft_support_to_cutting_materials_and_results.php delete mode 100644 database/migrations/2026_06_21_052600_drop_approval_columns_from_products_table.php delete mode 100644 database/migrations/2026_06_21_140151_add_harga_modal_to_cutting_result_prices_table.php delete mode 100644 database/migrations/2026_06_21_140243_add_harga_modal_to_orders_table.php delete mode 100644 database/migrations/2026_06_21_140243_add_harga_modal_to_product_prices_table.php delete mode 100644 database/migrations/2026_06_21_141248_add_pending_verification_status_to_cuttings_table.php delete mode 100644 database/migrations/2026_06_21_150000_add_submitted_by_id_to_cuttings_table.php diff --git a/BEST_PRACTICE.md b/BEST_PRACTICE.md index 683fb25..b47215b 100644 --- a/BEST_PRACTICE.md +++ b/BEST_PRACTICE.md @@ -14,6 +14,93 @@ ### Traits use FlashesEntityMessage, ParsesDataTableQuery; ``` +## Database & Migrasi + +### Struktur File Migrasi +- Gunakan *anonymous class* yang meng-extend `Migration`. +- Tulis *return type hint* `: void` secara eksplisit pada method `up()` dan `down()`. +- **Urutan & Pengelompokan Kolom (Ordering & Grouping):** + 1. **Primary Key**: `$table->id()` ditaruh paling atas. + 2. **Relasi (Foreign Keys / Morphs)**: Ditaruh tepat setelah Primary Key di bagian teratas. + 3. **Kolom Data Utama**: Dikelompokkan secara logis menggunakan spasi (baris kosong) sebagai pemisah antar kelompok data. + 4. **Timestamps & Soft Deletes**: Ditaruh paling bawah. +- **Gunakan:** + ```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('table_name', function (Blueprint $table) { + $table->id(); + + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->foreignId('category_id')->nullable()->constrained()->nullOnDelete(); + + $table->string('name', 100); + $table->string('description', 255)->nullable(); + + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('table_name'); + } + }; + ``` + +### Definisi Kolom & Tipe Data +- **ID & Timestamps:** + - Gunakan `$table->id()` sebagai primary key. + - Gunakan `timestamp` eksplisit dengan default `useCurrent()` dan `useCurrentOnUpdate()`. **Hindari penggunaan `$table->timestamps()` bawaan Laravel agar format kolom presisi dan konsisten.** + - Tambahkan `$table->softDeletes()` (atau `deleted_at`) jika model terkait menggunakan trait `SoftDeletes`. + ```php + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); + $table->softDeletes(); + ``` +- **Kolom Enum:** + - Hubungkan dengan PHP Backed Enum menggunakan `array_column(EnumName::cases(), 'value')`. + - **Contoh:** + ```php + $table->enum('status', array_column(StatusEnum::cases(), 'value'))->default(StatusEnum::PENDING->value); + ``` + +### Relasi & Foreign Key +- Gunakan `$table->foreignId()`. +- Tentukan constraint relasi secara eksplisit dengan `constrained()` (dan sebutkan nama tabel target jika nama kolom tidak sesuai dengan nama tabel, misal: `constrained('users')`). +- Tentukan aksi penghapusan secara eksplisit (`cascadeOnDelete()`, `nullOnDelete()`, atau `restrictOnDelete()`) sesuai kebutuhan integritas data. +- **Contoh:** + ```php + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->foreignId('category_id')->nullable()->constrained('categories')->nullOnDelete(); + ``` + +### Modifikasi Tabel (Alter Schema) +- Saat menambahkan kolom baru, gunakan modifier `->after('column_name')` agar tata letak kolom di database terstruktur dengan logis. +- Jika menambahkan kolom baru yang non-nullable pada tabel yang sudah berisi data, jalankan data migration di dalam method `up()` setelah schema builder: + ```php + DB::table('table_name')->update(['column_name' => 'default_value']); + ``` +- Di dalam method `down()`, pastikan untuk melepas constraint foreign key terlebih dahulu sebelum menghapus kolom bersangkutan. Gunakan `dropConstrainedForeignId` atau `dropForeign` untuk cara yang aman dan ringkas. + - **Gunakan:** + ```php + public function down(): void + { + Schema::table('table_name', function (Blueprint $table) { + $table->dropConstrainedForeignId('foreign_key_id'); + $table->dropColumn(['column_one', 'column_two']); + }); + } + ``` + ## JavaScript / Vue ### Struktur Folder Page-Specific Components diff --git a/database/migrations/0001_01_01_000000_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php index c2d56e0..37f3854 100644 --- a/database/migrations/0001_01_01_000000_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -12,7 +12,7 @@ public function up(): void { Schema::create('users', function (Blueprint $table) { - $table->unsignedBigInteger('id', true); + $table->id(); $table->string('email', 100)->unique(); $table->string('username', 20)->unique(); diff --git a/database/migrations/2026_06_10_120002_create_cash_transactions_table.php b/database/migrations/2026_06_10_120002_create_cash_transactions_table.php index e653b9f..24cbb24 100644 --- a/database/migrations/2026_06_10_120002_create_cash_transactions_table.php +++ b/database/migrations/2026_06_10_120002_create_cash_transactions_table.php @@ -14,8 +14,8 @@ public function up(): void $table->foreignId('cash_account_id')->constrained()->cascadeOnDelete(); $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); - $table->nullableMorphs('reference'); + $table->unsignedBigInteger('amount'); $table->unsignedBigInteger('balance_after'); $table->enum('type', array_column(CashTransactionType::cases(), 'value'))->default(CashTransactionType::DEPOSIT->value); diff --git a/database/migrations/2026_06_10_160001_create_employee_advances_table.php b/database/migrations/2026_06_10_160001_create_employee_advances_table.php index 193224a..12fbcc9 100644 --- a/database/migrations/2026_06_10_160001_create_employee_advances_table.php +++ b/database/migrations/2026_06_10_160001_create_employee_advances_table.php @@ -11,22 +11,24 @@ public function up(): void { Schema::create('employee_advances', function (Blueprint $table) { $table->id(); + + $table->foreignId('paid_by_id')->nullable()->constrained('users')->restrictOnDelete(); $table->foreignId('employee_id')->constrained()->cascadeOnDelete(); + $table->foreignId('verified_by_id')->nullable()->constrained('users')->restrictOnDelete(); + $table->foreignId('repayment_cash_transaction_id')->nullable()->unique()->constrained('cash_transactions')->restrictOnDelete(); + $table->foreignId('cash_transaction_id')->nullable()->unique()->constrained()->restrictOnDelete(); + $table->unsignedBigInteger('amount'); $table->string('description', 100); $table->date('due_date'); $table->enum('status', array_column(EmployeeAdvanceStatus::cases(), 'value')) ->default(EmployeeAdvanceStatus::PENDING->value); - $table->foreignId('cash_transaction_id')->nullable()->unique()->constrained()->restrictOnDelete(); - $table->foreignId('repayment_cash_transaction_id')->nullable()->unique()->constrained('cash_transactions')->restrictOnDelete(); $table->timestamp('verified_at')->nullable(); - $table->foreignId('verified_by_id')->nullable()->constrained('users')->restrictOnDelete(); $table->timestamp('paid_at')->nullable(); - $table->foreignId('paid_by_id')->nullable()->constrained('users')->restrictOnDelete(); - $table->timestamps(); - $table->index(['employee_id', 'status']); - $table->index(['status', 'created_at']); + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); + $table->softDeletes(); }); } diff --git a/database/migrations/2026_06_10_170001_create_rejections_table.php b/database/migrations/2026_06_10_170001_create_rejections_table.php index 7447c7d..55168ab 100644 --- a/database/migrations/2026_06_10_170001_create_rejections_table.php +++ b/database/migrations/2026_06_10_170001_create_rejections_table.php @@ -12,11 +12,10 @@ public function up(): void $table->id(); $table->nullableMorphs('rejectable'); + $table->foreignId('rejected_by_id')->constrained('users')->restrictOnDelete(); $table->string('reason', 500); - $table->foreignId('rejected_by_id')->constrained('users')->restrictOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_11_100001_create_payroll_periods_table.php b/database/migrations/2026_06_11_100001_create_payroll_periods_table.php index db5eaf5..50a4288 100644 --- a/database/migrations/2026_06_11_100001_create_payroll_periods_table.php +++ b/database/migrations/2026_06_11_100001_create_payroll_periods_table.php @@ -12,13 +12,13 @@ public function up(): void Schema::create('payroll_periods', function (Blueprint $table) { $table->id(); + $table->foreignId('closed_by_id')->nullable()->constrained('users')->nullOnDelete(); + $table->unsignedSmallInteger('year'); $table->unsignedTinyInteger('month'); $table->enum('status', array_column(PayrollPeriodStatus::cases(), 'value'))->default(PayrollPeriodStatus::OPEN->value); $table->timestamp('closed_at')->nullable(); - $table->foreignId('closed_by_id')->nullable()->constrained('users')->nullOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_11_100002_create_payrolls_table.php b/database/migrations/2026_06_11_100002_create_payrolls_table.php index 8d301e6..6f35ff1 100644 --- a/database/migrations/2026_06_11_100002_create_payrolls_table.php +++ b/database/migrations/2026_06_11_100002_create_payrolls_table.php @@ -15,6 +15,7 @@ public function up(): void $table->foreignId('payroll_period_id')->constrained()->cascadeOnDelete(); $table->foreignId('employee_id')->constrained()->cascadeOnDelete(); $table->foreignId('cash_transaction_id')->nullable()->unique()->constrained()->restrictOnDelete(); + $table->foreignId('paid_by_id')->nullable()->constrained('users')->nullOnDelete(); $table->unsignedInteger('base_salary'); $table->unsignedBigInteger('bonus_amount')->default(0); @@ -23,8 +24,6 @@ public function up(): void $table->enum('status', array_column(PayrollStatus::cases(), 'value'))->default(PayrollStatus::UNPAID->value); $table->timestamp('paid_at')->nullable(); - $table->foreignId('paid_by_id')->nullable()->constrained('users')->nullOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_11_100003_create_payroll_adjustments_table.php b/database/migrations/2026_06_11_100003_create_payroll_adjustments_table.php index 144bd44..f427669 100644 --- a/database/migrations/2026_06_11_100003_create_payroll_adjustments_table.php +++ b/database/migrations/2026_06_11_100003_create_payroll_adjustments_table.php @@ -11,14 +11,15 @@ public function up(): void { Schema::create('payroll_adjustments', function (Blueprint $table) { $table->id(); + $table->foreignId('payroll_id')->constrained()->cascadeOnDelete(); + $table->foreignId('attendance_id')->nullable()->constrained()->nullOnDelete(); + $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); $table->enum('type', array_column(PayrollAdjustmentType::cases(), 'value')); $table->unsignedBigInteger('amount'); $table->string('description', 100); - $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_11_120000_create_leave_requests_table.php b/database/migrations/2026_06_11_120000_create_leave_requests_table.php index b150110..61ac4d2 100644 --- a/database/migrations/2026_06_11_120000_create_leave_requests_table.php +++ b/database/migrations/2026_06_11_120000_create_leave_requests_table.php @@ -13,6 +13,7 @@ public function up(): void $table->id(); $table->foreignId('employee_id')->constrained()->cascadeOnDelete(); + $table->foreignId('verified_by_id')->nullable()->constrained('users')->restrictOnDelete(); $table->date('start_date'); $table->date('end_date'); @@ -20,8 +21,6 @@ public function up(): void $table->enum('status', array_column(LeaveRequestStatus::cases(), 'value'))->default(LeaveRequestStatus::PENDING->value); $table->timestamp('verified_at')->nullable(); - $table->foreignId('verified_by_id')->nullable()->constrained('users')->restrictOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_12_100001_create_orders_table.php b/database/migrations/2026_06_12_100001_create_orders_table.php index 7552d06..37e0a5f 100644 --- a/database/migrations/2026_06_12_100001_create_orders_table.php +++ b/database/migrations/2026_06_12_100001_create_orders_table.php @@ -17,6 +17,8 @@ public function up(): void $table->foreignId('customer_id')->nullable()->constrained()->nullOnDelete(); $table->foreignId('marketing_id')->nullable()->constrained('users')->nullOnDelete(); + $table->foreignId('cash_transaction_id')->nullable()->unique()->constrained()->restrictOnDelete(); + $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); $table->string('order_number', 30)->unique(); $table->enum('channel', array_column(OrderChannel::cases(), 'value')); @@ -33,10 +35,6 @@ public function up(): void $table->unsignedBigInteger('total_amount'); $table->text('notes')->nullable(); - $table->foreignId('cash_transaction_id')->nullable()->unique()->constrained()->restrictOnDelete(); - - $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_12_110001_create_cuttings_table.php b/database/migrations/2026_06_12_110001_create_cuttings_table.php index 0705dc3..3fd7c51 100644 --- a/database/migrations/2026_06_12_110001_create_cuttings_table.php +++ b/database/migrations/2026_06_12_110001_create_cuttings_table.php @@ -13,6 +13,9 @@ public function up(): void Schema::create('cuttings', function (Blueprint $table) { $table->id(); + $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); + $table->foreignId('submitted_by_id')->nullable()->constrained('users')->nullOnDelete(); + $table->enum('status', array_column(CuttingStatus::cases(), 'value'))->default(CuttingStatus::IN_PROGRESS->value); $table->string('description', 100)->nullable(); @@ -21,8 +24,6 @@ public function up(): void $table->unsignedBigInteger('other_cost')->default(0); $table->unsignedBigInteger('cost_per_unit')->nullable(); - $table->foreignId('created_by_id')->constrained('users')->restrictOnDelete(); - $table->timestamp('created_at')->useCurrent(); $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); $table->softDeletes(); diff --git a/database/migrations/2026_06_12_110002_create_cutting_materials_table.php b/database/migrations/2026_06_12_110002_create_cutting_materials_table.php index d7e85ce..f89332e 100644 --- a/database/migrations/2026_06_12_110002_create_cutting_materials_table.php +++ b/database/migrations/2026_06_12_110002_create_cutting_materials_table.php @@ -11,7 +11,8 @@ public function up(): void Schema::create('cutting_materials', function (Blueprint $table) { $table->id(); - $table->foreignId('cutting_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete(); + $table->foreignId('cutting_id')->nullable()->constrained()->cascadeOnDelete(); $table->foreignId('raw_material_price_id')->constrained()->restrictOnDelete(); $table->decimal('material_usage', 18, 2); diff --git a/database/migrations/2026_06_12_110003_create_cutting_results_table.php b/database/migrations/2026_06_12_110003_create_cutting_results_table.php index 2ad2b2e..39dc8ce 100644 --- a/database/migrations/2026_06_12_110003_create_cutting_results_table.php +++ b/database/migrations/2026_06_12_110003_create_cutting_results_table.php @@ -11,7 +11,8 @@ public function up(): void Schema::create('cutting_results', function (Blueprint $table) { $table->id(); - $table->foreignId('cutting_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->nullable()->constrained()->cascadeOnDelete(); + $table->foreignId('cutting_id')->nullable()->constrained()->cascadeOnDelete(); $table->foreignId('product_variant_id')->constrained()->restrictOnDelete(); $table->unsignedInteger('cutting_result'); diff --git a/database/migrations/2026_06_18_100006_add_attendance_id_to_payroll_adjustments_table.php b/database/migrations/2026_06_18_100006_add_attendance_id_to_payroll_adjustments_table.php deleted file mode 100644 index 87a3cd8..0000000 --- a/database/migrations/2026_06_18_100006_add_attendance_id_to_payroll_adjustments_table.php +++ /dev/null @@ -1,23 +0,0 @@ -foreignId('attendance_id')->nullable()->after('payroll_id')->constrained()->nullOnDelete(); - }); - } - - public function down(): void - { - Schema::table('payroll_adjustments', function (Blueprint $table): void { - $table->dropForeign(['attendance_id']); - $table->dropColumn('attendance_id'); - }); - } -}; diff --git a/database/migrations/2026_06_19_100001_add_approval_columns_to_products_table.php b/database/migrations/2026_06_19_100001_add_approval_columns_to_products_table.php deleted file mode 100644 index 5717168..0000000 --- a/database/migrations/2026_06_19_100001_add_approval_columns_to_products_table.php +++ /dev/null @@ -1,35 +0,0 @@ -string('status', 20)->default('pending')->after('is_active'); - $table->string('pending_action', 20)->nullable()->after('status'); - $table->boolean('was_ever_approved')->default(false)->after('pending_action'); - $table->timestamp('verified_at')->nullable()->after('was_ever_approved'); - $table->foreignId('verified_by_id')->nullable()->after('verified_at')->constrained('users')->nullOnDelete(); - $table->foreignId('submitted_by_id')->nullable()->after('verified_by_id')->constrained('users')->nullOnDelete(); - }); - - DB::table('products')->update([ - 'status' => 'approved', - 'was_ever_approved' => true, - ]); - } - - public function down(): void - { - Schema::table('products', function (Blueprint $table) { - $table->dropConstrainedForeignId('submitted_by_id'); - $table->dropConstrainedForeignId('verified_by_id'); - $table->dropColumn(['status', 'pending_action', 'was_ever_approved', 'verified_at']); - }); - } -}; diff --git a/database/migrations/2026_06_20_130000_create_homepage_configurations_table.php b/database/migrations/2026_06_20_130000_create_homepage_configurations_table.php index 4256aba..9bde298 100644 --- a/database/migrations/2026_06_20_130000_create_homepage_configurations_table.php +++ b/database/migrations/2026_06_20_130000_create_homepage_configurations_table.php @@ -10,7 +10,9 @@ public function up(): void { Schema::create('homepage_configurations', function (Blueprint $table) { $table->id(); - $table->timestamps(); + + $table->timestamp('created_at')->useCurrent(); + $table->timestamp('updated_at')->useCurrent()->useCurrentOnUpdate(); }); } diff --git a/database/migrations/2026_06_21_030000_add_draft_support_to_cutting_materials_and_results.php b/database/migrations/2026_06_21_030000_add_draft_support_to_cutting_materials_and_results.php deleted file mode 100644 index b0cb723..0000000 --- a/database/migrations/2026_06_21_030000_add_draft_support_to_cutting_materials_and_results.php +++ /dev/null @@ -1,36 +0,0 @@ -foreignId('cutting_id')->nullable()->change(); - $table->foreignId('user_id')->nullable()->after('id')->constrained()->cascadeOnDelete(); - }); - - Schema::table('cutting_results', function (Blueprint $table): void { - $table->foreignId('cutting_id')->nullable()->change(); - $table->foreignId('user_id')->nullable()->after('id')->constrained()->cascadeOnDelete(); - }); - } - - public function down(): void - { - Schema::table('cutting_materials', function (Blueprint $table): void { - $table->dropForeign(['user_id']); - $table->dropColumn('user_id'); - $table->foreignId('cutting_id')->nullable(false)->change(); - }); - - Schema::table('cutting_results', function (Blueprint $table): void { - $table->dropForeign(['user_id']); - $table->dropColumn('user_id'); - $table->foreignId('cutting_id')->nullable(false)->change(); - }); - } -}; diff --git a/database/migrations/2026_06_21_052600_drop_approval_columns_from_products_table.php b/database/migrations/2026_06_21_052600_drop_approval_columns_from_products_table.php deleted file mode 100644 index 898dc49..0000000 --- a/database/migrations/2026_06_21_052600_drop_approval_columns_from_products_table.php +++ /dev/null @@ -1,29 +0,0 @@ -dropConstrainedForeignId('submitted_by_id'); - $table->dropConstrainedForeignId('verified_by_id'); - $table->dropColumn(['status', 'pending_action', 'was_ever_approved', 'verified_at']); - }); - } - - public function down(): void - { - Schema::table('products', function (Blueprint $table) { - $table->string('status', 20)->default('pending')->after('is_active'); - $table->string('pending_action', 20)->nullable()->after('status'); - $table->boolean('was_ever_approved')->default(false)->after('pending_action'); - $table->timestamp('verified_at')->nullable()->after('was_ever_approved'); - $table->foreignId('verified_by_id')->nullable()->after('verified_at')->constrained('users')->nullOnDelete(); - $table->foreignId('submitted_by_id')->nullable()->after('verified_by_id')->constrained('users')->nullOnDelete(); - }); - } -}; diff --git a/database/migrations/2026_06_21_140151_add_harga_modal_to_cutting_result_prices_table.php b/database/migrations/2026_06_21_140151_add_harga_modal_to_cutting_result_prices_table.php deleted file mode 100644 index 7094fb5..0000000 --- a/database/migrations/2026_06_21_140151_add_harga_modal_to_cutting_result_prices_table.php +++ /dev/null @@ -1,23 +0,0 @@ -foreignId('submitted_by_id') - ->nullable() - ->after('created_by_id') - ->constrained('users') - ->nullOnDelete(); - }); - } - - public function down(): void - { - Schema::table('cuttings', function (Blueprint $table) { - $table->dropConstrainedForeignId('submitted_by_id'); - }); - } -};