refactor: remove syncing

This commit is contained in:
2026-03-16 13:56:10 +08:00
parent 58f42de9df
commit 8d30a0419d
18 changed files with 25 additions and 954 deletions

View File

@@ -16,9 +16,11 @@ return new class extends Migration
$table->string('name')->comment('终端名称');
$table->string('code', 100)->unique()->comment('终端编码');
$table->string('ip_address', 45)->nullable()->comment('IP地址');
$table->string('mac_address', 17)->nullable()->unique()->comment('MAC地址 (AA:BB:CC:DD:EE:FF)');
$table->string('station_id', 50)->nullable()->comment('线站ID');
$table->string('diagram_url', 500)->nullable()->comment('组态图URL');
$table->json('display_config')->nullable()->comment('显示配置');
$table->string('diagram_url', 500)->nullable()->comment('组态界面地址');
$table->string('scada_data_url', 500)->nullable()->comment('网关数据查询地址');
$table->string('scada_tags_url', 500)->nullable()->comment('网关点位定义查询地址');
$table->boolean('is_online')->default(false)->comment('在线状态');
$table->timestamp('last_online_at')->nullable()->comment('最后在线时间');
$table->timestamps();

View File

@@ -1,44 +0,0 @@
<?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('terminal_sync_logs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('terminal_id')->comment('终端ID');
$table->enum('status', ['pending', 'syncing', 'synced', 'failed'])
->default('pending')
->comment('同步状态');
$table->json('config_snapshot')->nullable()->comment('配置快照');
$table->timestamp('synced_at')->nullable()->comment('同步时间');
$table->text('error_message')->nullable()->comment('错误信息');
$table->timestamps();
// 添加外键约束
$table->foreign('terminal_id')
->references('id')
->on('terminals')
->onDelete('cascade');
// 添加索引
$table->index('status', 'idx_terminal_sync_logs_status');
$table->index('synced_at', 'idx_terminal_sync_logs_synced_at');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('terminal_sync_logs');
}
};

View File

@@ -1,27 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('terminals', function (Blueprint $table) {
$table->string('mac_address', 17)->nullable()->unique()->after('ip_address')
->comment('MAC地址 (AA:BB:CC:DD:EE:FF)');
$table->string('scada_data_url', 500)->nullable()->after('diagram_url')
->comment('OPC UA网关数据查询地址');
$table->string('scada_tags_url', 500)->nullable()->after('scada_data_url')
->comment('OPC UA网关点位定义查询地址');
});
}
public function down(): void
{
Schema::table('terminals', function (Blueprint $table) {
$table->dropColumn(['mac_address', 'scada_data_url', 'scada_tags_url']);
});
}
};