4
0
Fork 0
dcat-admin/packages/article/updates/AddnumToArticleTable.php

37 lines
877 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddnumToArticleTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (Schema::hasTable('articles')) {
Schema::table('articles', function (Blueprint $table) {
$table->unsignedBigInteger('like_nums')->default(0)->comment('点赞数');
$table->unsignedBigInteger('read_nums')->default(0)->comment('阅读数');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('articles', function (Blueprint $table) {
//
$table->dropColumn(['like_nums', 'read_nums']);
});
}
};