<?php
// Patch: linkage columns for cross-module automation
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::table('sales_invoices', function (Blueprint $table) {
            $table->unsignedBigInteger('reference_ipc')->nullable()->index()->after('delivery_note_id');
        });
        Schema::table('purchase_orders', function (Blueprint $table) {
            $table->string('status', 25)->default('draft')->change();
        });
    }
    public function down(): void {
        Schema::table('sales_invoices', function (Blueprint $table) {
            $table->dropColumn('reference_ipc');
        });
    }
};
