lcly-data-admin/database/migrations/2022_10_14_095443_create_de...

42 lines
1.4 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->id();
$table->unsignedBigInteger('agricultural_base_id')->comment('农业基地ID');
$table->string('sn')->comment('序列号');
$table->string('name')->nullable()->comment('名称');
$table->string('model')->nullable()->comment('型号');
$table->string('monitoring_point')->nullable()->comment('监控点');
$table->tinyInteger('type')->comment('类型: 1 监控设备, 2 土壤设备, 3 水质设备, 4 气象设备');
$table->tinyInteger('status')->default(2)->comment('状态: 0 禁用, 1 在线, 2 离线, 3 故障');
$table->json('extends')->nullable()->comment('扩展信息');
$table->unsignedBigInteger('created_by')->comment('创建人ID');
$table->unsignedBigInteger('updated_by')->comment('修改人ID');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('devices');
}
};