<?php

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

return new class extends Migration {
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {
            $table->id();
            $table->string("name")->default("")->comment("昵称");
            $table->string("phone")->default("");
            $table->string("password")->default("");
            $table->string("email")->default("");
            $table->unsignedTinyInteger("status")->default(0)->comment("0 禁用 1启用");
            $table->unsignedInteger("group_id")->default(0);
            $table->string("openid")->default("")->comment("微信openid");
            $table->string("extra", 2000)->default("")->comment("糊屎字段");
            $table->timestamps();

            $table->index("openid");
            $table->index("email");
        });

        Schema::create('admin_group', function (Blueprint $table) {
            $table->id();
            $table->string("name")->default("");
            $table->timestamps();
        });
        Schema::create('admin_permission', function (Blueprint $table) {
            $table->id();
            $table->string("name")->default("");
            $table->string("code")->default("");
            $table->timestamps();
        });
    }

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