<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('partners', function (Blueprint $table) {
            $table->string("openid",50)->nullable()->change();
        });
        DB::statement("alter table `ufutx_partners` drop index `openid_unique`");
        DB::statement("ALTER TABLE ufutx_partners ADD INDEX openid (openid);");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('partners', function (Blueprint $table) {
            $table->string('openid',50)->nullable(false)->change(); // 这里需要确保没有null值在该列中
        });
    }
};
