<?php

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

class CreateBuyFactorProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('buy_factor_products', function (Blueprint $table) {
            $table->id();
            $table->foreignId('factor_id')->constrained('buy_factors')->onDelete('cascade');
            $table->string('name')->nullable();
            $table->string('count')->default(0);
            $table->string('price')->default(0);
            $table->string('total')->default(0);
            $table->timestamps();
        });
    }

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