123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- use Illuminate\Database\Migrations\Migration;
- use Illuminate\Database\Schema\Blueprint;
- use Illuminate\Support\Facades\Schema;
- class CreateDiarySleepsTable extends Migration
- {
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
- Schema::create('diary_sleeps', function (Blueprint $table) {
- $table->id();
-
- $table->bigInteger('uid')->comment('用户id');
- $table->bigInteger('level_id')->comment('等级id')->index();
- $table->date('day')->comment('某天');
- $table->dateTime('start_time')->comment('开始时间');
- $table->dateTime('end_time')->comment('结束时间');
- $table->string('duration_of_time')->comment('持续时间');
- $table->decimal('score', 10, 2)->default(0.00)->comment('睡眠得分');
- $table->string('repeat')->comment('去重 day:uid')->unique();
-
- $table->timestamps();
- $table->softDeletes();
- });
- }
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
- Schema::dropIfExists('diary_sleeps');
- }
- }
|