Skip to content

Instantly share code, notes, and snippets.

@mattaebersold
Created May 7, 2019 04:24
Show Gist options
  • Save mattaebersold/264ea0797318da9afcadb74167a7e1a2 to your computer and use it in GitHub Desktop.
Save mattaebersold/264ea0797318da9afcadb74167a7e1a2 to your computer and use it in GitHub Desktop.
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class ExhibitionEventPivot extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('exhibition_calendar_event', function($t){
$t->increments('id');
$t->integer('exhibition_id')->unsigned();
$t->integer('calendar_event_id')->unsigned();
$t->integer('position')->unsigned();
$t->timestamps();
$t->foreign('exhibition_id')->references('id')->on('exhibitions')->onUpdate('cascade')->onDelete('cascade');
$t->foreign('calendar_event_id')->references('id')->on('calendar_events')->onUpdate('cascade')->onDelete('cascade');
$t->index(array('position', 'calendar_event_id'));
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('exhibition_calendar_event');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment