40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create('devices', function (Blueprint $table) {
|
|
$table->engine = 'InnoDB';
|
|
$table->id();
|
|
$table->string('name')->comment('设备名称');
|
|
$table->string('sn')->comment('设备唯一编码');
|
|
$table->unsignedBigInteger('powered_by')->nullable()->comment('厂家');
|
|
$table->string('model_sn')->nullable()->comment('型号');
|
|
$table->unsignedTinyInteger('type')->comment('类型: 1 监控设备, 2 土壤设备, 3 水质设备, 4 气象设备');
|
|
$table->unsignedTinyInteger('state')->default(2)->comment('状态: 0 禁用, 1 在线, 2 离线, 3 故障');
|
|
$table->text('extends')->nullable()->comment('扩展信息');
|
|
$table->timestamps();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('devices');
|
|
}
|
|
};
|