ufutx.dma/database/migrations/2024_06_11_165353_change_table_partners.php
2026-03-04 14:42:40 +08:00

36 lines
923 B
PHP

<?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值在该列中
});
}
};