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