update table

This commit is contained in:
2026-03-09 10:15:25 +08:00
parent ac5b17c719
commit a2e8143b6a
@@ -0,0 +1,30 @@
<?php
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->boolean('api_key_enabled')->default(false)->comment('是否允许使用 API Key');
$table->foreign('role_id')->references('id')->on('roles')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['role_id']);
$table->dropColumn('api_key_enabled');
});
}
};