update logic
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
class AddSubarticles extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$builder = Capsule::schema();
|
||||
|
||||
$builder->table('articles', function($table) {
|
||||
|
||||
$table->unsignedInteger('main_article_id')->nullable();
|
||||
$table->foreign('main_article_id')->references('id')->on('articles');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$builder = Capsule::schema();
|
||||
|
||||
$builder->table('articles', function($table) {
|
||||
$table->dropColum('main_article_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user