<?php

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

class CreateUserWechatOfficialsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_wechat_officials', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_wechat_id');
            $table->string('openid');
            $table->boolean('subscribe')->comment('关注公众平台')->default(0);
            $table->timestamp('subscribed_at')->nullable();
            $table->string('subscribe_scene', 32)->comment('关注场景')->nullable();
            $table->timestamps();
        });
    }

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