update
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?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::create('operation_logs', function (Blueprint $table) {
|
||||
$table->id()->comment('主键');
|
||||
$table->unsignedBigInteger('user_id')->comment('操作用户 ID');
|
||||
$table->string('action', 50)->comment('操作类型');
|
||||
$table->string('target_type', 50)->comment('操作目标类型');
|
||||
$table->unsignedBigInteger('target_id')->nullable()->comment('操作目标 ID');
|
||||
$table->string('description', 500)->comment('操作描述');
|
||||
$table->jsonb('detail')->nullable()->comment('操作详情');
|
||||
$table->string('ip', 45)->nullable()->comment('客户端 IP');
|
||||
$table->timestampTz('created_at')->useCurrent()->comment('创建时间');
|
||||
|
||||
$table->index('user_id');
|
||||
$table->index('action');
|
||||
$table->index(['target_type', 'target_id']);
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('operation_logs');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user