[增添]添加了MetricResource的数据库以及页面元素
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('metrics', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
|
||||
// 命名空间索引
|
||||
$table->integer('namespace_index');
|
||||
|
||||
// 标识符类型,存储为整数
|
||||
// 1 = Numeric, 2 = String, 3 = GUID
|
||||
$table->Integer('identifier_type');
|
||||
|
||||
// 数值型标识符
|
||||
$table->integer('numeric_id')->nullable();
|
||||
|
||||
// 字符串型标识符
|
||||
$table->string('string_id')->nullable();
|
||||
|
||||
// GUID 型标识符
|
||||
$table->char('guid_id', 36)->nullable();
|
||||
|
||||
$table->string('help')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
// 在同一命名空间中,确保唯一标识符唯一
|
||||
$table->unique(['namespace_index', 'numeric_id']);
|
||||
$table->unique(['namespace_index', 'string_id']);
|
||||
$table->unique(['namespace_index', 'guid_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('metrics');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user