<?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('band_origin_battery', function (Blueprint $table) {
            $table->id();
            $table->integer('user_id')->unsigned()->comment("用户id");
            $table->integer('band_id')->unsigned()->comment("手环id");
            $table->timestamp('date')->nullable()->comment("时间");
            $table->text("value")->nullable()->comment("数据");
            $table->timestamps();
            $table->unique(['user_id', 'band_id', 'date']);
        });
    }

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