Created
June 20, 2018 02:06
-
-
Save tghelere/fd2fa49ff7d636fa5191414bdc6e4b8b to your computer and use it in GitHub Desktop.
This file contains 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\Support\Facades\Schema; | |
use Illuminate\Database\Schema\Blueprint; | |
use Illuminate\Database\Migrations\Migration; | |
class CreateCategoryPostTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
Schema::create('category_post', function (Blueprint $table) { | |
$table->increments('id'); | |
$table->integer('category_id')->unsigned(); | |
$table->integer('post_id')->unsigned(); | |
$table->foreign('category_id')->references('id')->on('categories'); | |
$table->foreign('post_id')->references('id')->on('posts'); | |
$table->timestamps(); | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('category_post'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment