<?php

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

class CreateConfigsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable('configs')) {
            return;
        }

        Schema::create('configs', function (Blueprint $table) {
            $table->string('name', 100)->comment('配置名称');
            $table->text('value')->nullable()->comment('缓存值');
            $table->timestamps();
            $table->primary('name');

            $table->comment('配置表');
        });
    }

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