<?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::table('collaborator', function (Blueprint $table) {
            $table->string('openid',191)->nullable()->comment('用户openid')->change();
//            // 删除原来的唯一索引
            $table->dropUnique('ufutx_collaborator_openid_unique');
            // 创建新的普通索引
            $table->index('openid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('collaborator', function (Blueprint $table) {
            $table->string('openid',255)->comment('用户openid');
            // 撤销操作时，重新创建原来的唯一索引
            $table->unique('openid');
            // 删除新的普通索引
            $table->dropIndex('openid');
        });
    }
};
