<?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('order_dist_records', function (Blueprint $table) {
            $table->comment('订单分销记录');
            $table->increments('id');
            $table->unsignedBigInteger('order_id')->comment('订单编号');
            $table->unsignedBigInteger('object_id')->comment('对象编号');
            $table->string('object_type')->default('')->comment('对象类型');
            $table->string('dist_type')->default('')->comment('分销类型');
            $table->decimal('amount')->default(new \Illuminate\Database\Query\Expression('0.00'))->comment('分销金额');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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