2023_03_02_213237_alter_user_profiles.php 1.43 KB
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlterUserProfiles extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::table('user_profiles', function (Blueprint $table) {
            $table->string('intro')->after('user_id')->default("")->comment('简介');
            $table->date('birthday')->after('intro')->default("2023-01-01")->comment('生日');

//            $table->unsignedInteger('follow_count')->after('video_count')->default(0)->comment('关注数');
//            $table->unsignedInteger('fans_count')->after('follow_count')->default(0)->comment('粉丝数');
//            $table->unsignedInteger('popular_count')->after('fans_count')->default(0)->comment('人气数');

            $table->unsignedInteger('praised_count')->after('video_count')->default(0)->comment('被点赞数');
            $table->unsignedInteger('collected_count')->after('praised_count')->default(0)->comment('被收藏数');

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::dropColumns('user_profiles', ['intro','birthday','follow_count','fans_count','popular_count']);
//        Schema::dropColumns('user_profiles', ['intro','birthday','praised_count','collected_count']);
    }
}