add developper binding to platform

This commit is contained in:
2026-03-05 10:22:54 +08:00
parent 4c49c2b71c
commit 1d7a4c7176
3 changed files with 56 additions and 3 deletions
@@ -0,0 +1,32 @@
<?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('platforms', function (Blueprint $table) {
$table->unsignedBigInteger('developer_id')->default(1)->comment('数据维护者,关联 users.id');
$table->foreign('developer_id')->references('id')->on('users')->onDelete('restrict');
$table->index('developer_id', 'idx_platforms_developer_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('platforms', function (Blueprint $table) {
$table->dropForeign(['developer_id']);
$table->dropIndex('idx_platforms_developer_id');
$table->dropColumn('developer_id');
});
}
};