<?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_subitems', function (Blueprint $table) {
            $table->foreign(['contract_id'], 'contract_foreign_key')->references(['id'])->on('contracts')->onUpdate('cascade')->onDelete('cascade');
        });
    }

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