<?php

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

class CreateOwnerReportsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('owner_reports', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('owner_id')->index()->comment('外键货主');
            $table->date('counting_month')->nullable()->comment('结算月');
            $table->decimal('daily_average_order_amount',11,2)->nullable()->comment('日均单量');
            $table->integer('total')->nullable()->comment("结算月总单量");
            $table->decimal('current_month_counting_area',11,2)->nullable()->comment('结算月盘点面积');
            $table->decimal('last_month_counting_area',11,2)->nullable()->comment('结算月上月盘点面积');
            $table->bigInteger('owner_bill_report_id')->nullable()->index()->comment('账单');
            $table->timestamp('created_at');
        });
    }

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