-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
FreedomKnight
committed
Feb 9, 2018
1 parent
20fceda
commit e013134
Showing
5 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
database/migrations/0000_00_00_000000_update_taggable_table.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class UpdateTaggableTable extends Migration | ||
{ | ||
|
||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
$connection = config('taggable.connection'); | ||
|
||
Schema::connection($connection)->table('taggable_tags', function (Blueprint $table) { | ||
$table->unsignedInteger('parent_id')->nullable(); | ||
$table->foreign('parent_id')->references('id')->on('taggable_tags')->onDelete('null'); | ||
$table->index('parent_id'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
$connection = config('taggable.connection'); | ||
|
||
Schema::connection($connection)->table('taggable_tags', function (Blueprint $table) { | ||
$table->dropForeign('taggable_tags_parent_id_foreign'); | ||
}); | ||
} | ||
} |
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
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
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
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