<?php

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

class CreateUserIdentityLogsTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('user_identity_logs', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('user_id')->comment('用户ID');
            $table->unsignedBigInteger('before')->comment('变化前身份');
            $table->unsignedBigInteger('after')->comment('变化后身份');
            $table->string('channel', 20)->nullable()->comment('变化渠道');
            $table->string('remark', 200)->nullable()->comment('备注');
            $table->json('source')->nullable()->comment('附加溯源信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_identity_logs');
    }

}
