<?php

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

class CreateBlockServiceSolutionTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('block_service_solution', function (Blueprint $table) {
            $table->unsignedBigInteger('service_solution_id');
            $table->unsignedBigInteger('block_id');
            $table->unsignedInteger('position')->nullable();
            $table->foreign('service_solution_id')->references('id')
                ->on('service_solutions')->onDelete('CASCADE')->onUpdate('CASCADE');
            $table->foreign('block_id')->references('id')
                ->on('blocks')->onDelete('CASCADE')->onUpdate('CASCADE');
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('block_service_solution');
    }
}
