<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('contract_sub_items_histories', function (Blueprint $table) {
            $table->foreign(['subitem_id'])->references(['id'])->on('contract_subitems')->onUpdate('cascade')->onDelete('set null');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('contract_sub_items_histories', function (Blueprint $table) {
            $table->dropForeign('contract_sub_items_histories_subitem_id_foreign');
        });
    }
};
