<?php

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

class CreateUserSmsTable extends Migration
{

    /**
     * Run the migrations.
     * @return void
     */
    public function up()
    {
        Schema::create('user_sms', function (Blueprint $table) {
            $table->id();
            $table->string('mobile', 16);
            $table->string('channel', 16)->comment('验证渠道，一般对应TEMPLATE_ID');
            $table->string('gateway', 16)->nullable()->comment('发送网关');
            $table->string('content')->comment('短信内容，验证或通知');
            $table->boolean('used')->default(0);
            $table->timestamps();

            $table->index(['mobile', 'channel']);
        });
    }

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

}