<?php

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

class CreatePricingRulesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('pricing_rules', function (Blueprint $table) {
            $table->id();
            $table->integer('product_id')->nullable();
            $table->double('price', 15, 2)->nullable();
            $table->timestamps();
        });

        Schema::create('pricing_rule_options', function (Blueprint $table) {
            $table->id();
            $table->integer('pricing_rule_id')->nullable();
            $table->integer('option_id')->nullable();
            $table->integer('option_detail_id')->nullable();
            $table->timestamps();
        });
    }

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