##File: database/migrations/2019_10_21_162209_skipper_migrations_2019102116220956.php
<?php
/*
* Migrations generated by: Skipper (http://www.skipper18.com)
* Migration id: 057b401d-fb53-4e1f-bc52-90e8a6876c44
* Migration datetime: 2019-10-21 16:22:09.561807
*/
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SkipperMigrations2019102116220956 extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->bigInteger('id')->autoIncrement()->unsigned();
});
Schema::create('taggable', function (Blueprint $table) {
$table->('tag_id')->nullable(true);
$table->bigInteger('taggable_id')->nullable(true)->unsigned();
$table->string('taggable_type')->nullable(true)->unsigned();
});
Schema::create('posts', function (Blueprint $table) {
$table->bigInteger('id')->autoIncrement()->unsigned();
});
Schema::create('videos', function (Blueprint $table) {
$table->bigInteger('id')->autoIncrement()->unsigned();
});
Schema::table('taggable', function (Blueprint $table) {
$table->foreign('tag_id')->references('id')->on('tags');
$table->foreign()->references()->on('posts');
});
Schema::table('taggable', function (Blueprint $table) {
$table->foreign('tag_id')->references('id')->on('tags');
$table->foreign()->references()->on('videos');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('taggable', function (Blueprint $table) {
$table->dropForeign('tag_id');
$table->dropForeign();
});
Schema::table('taggable', function (Blueprint $table) {
$table->dropForeign('tag_id');
$table->dropForeign();
});
Schema::dropIfExists('videos');
Schema::dropIfExists('posts');
Schema::dropIfExists('taggable');
Schema::dropIfExists('tags');
}
}