<?php

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

class AddForeignKeysToDocumentFeedsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('document_feeds', function (Blueprint $table) {
            $table->foreign('document_id')->references('id')->on('documents')->onDelete('CASCADE');
            $table->foreign('feed_id')->references('id')->on('feeds')->onDelete('CASCADE');
        });
    }

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