2021_04_13_024647_create_devices_table.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. use Illuminate\Database\Migrations\Migration;
  3. use Illuminate\Database\Schema\Blueprint;
  4. use Illuminate\Support\Facades\Schema;
  5. class CreateDevicesTable extends Migration
  6. {
  7. /**
  8. * Run the migrations.
  9. *
  10. * @return void
  11. */
  12. public function up()
  13. {
  14. Schema::create('devices', function (Blueprint $table) {
  15. $table->id();
  16. $table->char('no', 20)->comment('设备编号');
  17. $table->char('box_no', 20)->comment('设备硬件编号');
  18. $table->double('lat', 12, 8)->default(0.00000000)->comment('维度');
  19. $table->double('lng', 12, 8)->default(0.00000000)->comment('经度');
  20. $table->string('temperature')->nullable()->comment('设备温度');
  21. $table->tinyInteger('water_level_warning')->default(0)->comment('水位警告状态');
  22. $table->string('water_quality')->nullable()->comment('水质');
  23. $table->timestamp('last_update_time')->nullable()->comment('最后更新的时间');
  24. $table->integer('box_status')->default(0)->comment('设备状态');
  25. $table->tinyInteger('a')->default(0)->comment('A路状态');
  26. $table->tinyInteger('b')->default(0)->comment('B路状态');
  27. $table->tinyInteger("is_use")->default(0)->comment('是否可用');
  28. $table->tinyInteger("is_line")->default(0)->comment('是否在线');
  29. $table->bigInteger('shop_id')->default(0);
  30. $table->bigInteger('admin_id')->default(0)->comment('归属人');
  31. $table->tinyInteger('status')->default(1);
  32. $table->timestamps();
  33. });
  34. }
  35. /**
  36. * Reverse the migrations.
  37. *
  38. * @return void
  39. */
  40. public function down()
  41. {
  42. Schema::dropIfExists('devices');
  43. }
  44. }