Created
May 7, 2019 04:24
-
-
Save mattaebersold/264ea0797318da9afcadb74167a7e1a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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