Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save devmeireles/2be6532023de274ed916b7372e211645 to your computer and use it in GitHub Desktop.
Save devmeireles/2be6532023de274ed916b7372e211645 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Eloquent\SoftDeletes;
class CreatePeliculaCategoria extends Migration
{
use SoftDeletes;
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('pelicula_categoria', function (Blueprint $table) {
$table->increments('id_pelicula_categoria');
$table->integer('id_pelicula')->unsigned();
$table->integer('id_categoria')->unsigned();
$table->foreign('id_pelicula')
->references('id_pelicula')->on('pelicula')
->onDelete('cascade');
$table->foreign('id_categoria')
->references('id_categoria')->on('categoria')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('pelicula_categoria');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment