<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProcessDailyParticipantsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * 加工单每日参与人记录
     *
     * @return void
     */
    public function up()
    {
        Schema::create('process_daily_participants', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('process_daily_id')->index()->comment('外键每日记录');
            $table->bigInteger('user_id')->index()->comment('外键用户');
            $table->time('started_at')->nullable()->comment('开始时间');
            $table->time('ended_at')->nullable()->comment('开始时间');
            $table->decimal('hour_price')->nullable()->comment('计时单价');
            $table->tinyInteger('hour_count')->nullable()->comment('计时工时');
            $table->decimal('unit_price')->nullable()->comment('计件单价');
            $table->integer('unit_count')->nullable()->comment('计件数');
            $table->integer('dinner_duration')->default(0)->comment('晚饭时间');
            $table->string('remark')->nullable()->comment('备注');
            $table->timestamps();
        });
    }

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