<?php

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Modules\User\Database\Seeders\UserCertificationConfigsSeeder;

class CreateUserCertificationConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_certification_configs', function (Blueprint $table) {
            $table->id();
            $table->boolean('is_open')->default(0)->comment('开通第三方认证');
            $table->boolean('is_ocr_open')->default(0)->comment('开通OCR认证,第三方认证开启时有效');
            $table->boolean('type')->default(1);
            $table->string('code')->nullable()->comment('个人认证接口code');
            $table->string('url')->nullable()->comment('个人认证接口地址');
            $table->string('ocr_appid')->nullable()->comment('ocr认证配置');
            $table->string('ocr_secretkey')->nullable()->comment('ocr认证配置');
            $table->boolean('status')->default(0);
            $table->timestamps();
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_certification_configs');
        Artisan::call('db:seed', [
            '--class' => UserCertificationConfigsSeeder::class,
        ]);
    }
}
