blessing-skin-server/database/migrations/2019_05_05_103143_add_likes_field.php
2019-12-14 11:10:37 +08:00

27 lines
662 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
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');
});
}
}
}