<?php

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

class CreateBounsUserPervesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('bouns_user_perves', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('user_id')->comment('用户ID');
            $table->timestamp('date')->nullable()->comment('分红时间');
            $table->unsignedInteger('star')->nullable()->comment('当时星级');
            $table->unsignedDecimal('old_perf', 12, 2)->default(0)->comment('累计业绩');
            $table->unsignedDecimal('new_perf', 12, 2)->default(0)->comment('新增业绩');
            $table->unsignedDecimal('price', 12, 6)->nullable()->comment('单价');
            $table->unsignedDecimal('amount', 12, 2)->nullable()->comment('应得');
            $table->boolean('status')->default(0)->comment('状态');

            $table->timestamps();
        });
    }

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