Paragonik/paragonik-backend/database/migrations/2019_12_01_190021_create_ca...

36 lines
946 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesServicesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories_services', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('category_id')->unsigned();
$table->bigInteger('service_id')->unsigned();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
$table->foreign('service_id')->references('id')->on('services')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categories_services');
}
}