blessing-skin-server/database/migrations/2019_05_05_103143_add_likes_field.php

27 lines
662 B
PHP
Raw Normal View History

<?php
use Illuminate\Database\Migrations\Migration;
2019-12-14 11:10:37 +08:00
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddLikesField extends Migration
{
public function up()
{
2019-12-14 11:10:37 +08:00
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');
});
}
}
}