update backend p20.1 p20.2

This commit is contained in:
2026-04-16 13:16:43 +08:00
parent a870793704
commit ff9951bb43
11 changed files with 440 additions and 21 deletions
@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
use Hyperf\Database\Schema\Schema;
use Hyperf\Database\Schema\Blueprint;
use Hyperf\Database\Migrations\Migration;
return new class extends Migration
{
/**
* 添加 (user_id, key_hash) 联合索引,支撑新 key 格式的精确查询
*/
public function up(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->index(['user_id', 'key_hash'], 'idx_api_keys_user_id_key_hash');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('api_keys', function (Blueprint $table) {
$table->dropIndex('idx_api_keys_user_id_key_hash');
});
}
};