<?php

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

class CreateSystemFoodsMealsTable extends Migration {

	public function up()
	{
		Schema::create('system_foods_meals', function(Blueprint $table) {
			$table->increments('id');

			$table->integer('system_food_id')->unsigned()->nullable();
			$table->foreign('system_food_id')->references('id')->on('system_foods');

			$table->integer('meal_id')->unsigned()->nullable();
			$table->foreign('meal_id')->references('id')->on('meals');
			
            $table->softDeletes();
            $table->timestamps();
            $table->engine = 'InnoDB';
		});
	}

	public function down()
	{
		Schema::drop('system_foods_meals');
	}
}