blessing-skin-server/database/migrations/2019_05_05_103143_add_likes_field.php
2019-05-05 11:21:37 +08:00

27 lines
663 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddLikesField extends Migration
{
public function up()
{
if (! Schema::hasColumn('textures', 'likes')) {
Schema::table('textures', function (Blueprint $table) {
$table->integer('likes')->unsigned()->default(0);
});
}
}
public function down()
{
if (Schema::hasColumn('textures', 'likes')) {
Schema::table('textures', function (Blueprint $table) {
$table->dropColumn('likes');
});
}
}
}