2022_03_28_122608_alter_user_profiles_table.php
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AlterUserProfilesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('user_profiles', function (Blueprint $table) {
            $table->unsignedInteger('user_id')->after('id')->comment('用户id');
            $table->unsignedTinyInteger('is_vip')->after('unionid')->default('0')->comment('是否会员');
            $table->timestamp('create_vip_time')->after('is_vip')->nullable()->comment('会员创建时间');
            $table->timestamp('expire_vip_time')->after('create_vip_time')->nullable()->comment('会员失效时间');
            $table->unsignedInteger('buy_number')->default(0)->comment('购买次数')->change();
            $table->decimal('buy_amount')->default(0.00)->comment('消费金额')->change();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropColumns('user_profiles', ['is_vip','create_vip_time','expire_vip_time']);
    }
}