<?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('device', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->comment('用户id');
            $table->tinyInteger('type')->default(0)->comment('设备类型 0:体脂秤 1:手表 2:手环');
            $table->tinyInteger('sub_type')->default(0)->comment('子类型 如果是体脂秤 0:天晟 1:云康宝');
            $table->string('name')->nullable()->comment('设备别名');
            $table->string('device_id')->nullable()->comment('设备唯一标识');
            $table->string('device_data')->nullable()->comment('设备信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('device');
    }
};
