<?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('shop_order_details', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('order_id')->nullable()->index('order_id');
            $table->unsignedInteger('offer_id')->nullable()->index('offer_id');
            $table->tinyText('name')->nullable();
            $table->unsignedInteger('quantity')->default(0);
            $table->unsignedDecimal('vat', 5)->default(0);
            $table->unsignedDecimal('price', 7)->default(0);
            $table->unsignedDecimal('tax', 7)->default(0);
            $table->unsignedDecimal('price_taxed', 7)->default(0);
            $table->unsignedDecimal('total', 7)->default(0);
            $table->unsignedDecimal('total_tax', 7)->default(0);
            $table->unsignedDecimal('total_taxed', 7)->default(0);
            $table->unsignedMediumInteger('weight')->default(0);
            $table->timestamps();
            $table->softDeletes();
        });
    }

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