<?php

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

class CreateShippingCostsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
		Schema::create('areas', function (Blueprint $table) {
			$table->id();
			$table->string('name');
			$table->string('slug')->nullable();
			$table->unsignedBigInteger('parent_id')->default(0);
			$table->tinyText('description')->nullable();
			$table->unsignedInteger('position')->default(0);
			$table->unsignedSmallInteger('is_activated')->default(1);
			$table->unsignedSmallInteger('is_deleted')->default(0);
			$table->timestamps();
		});
		
        Schema::create('shipping_costs', function (Blueprint $table) {
            $table->id();
			$table->unsignedBigInteger('area_id');
			$table->decimal('price', 15, 2)->default(0);
			$table->decimal('free_from', 15, 2)->nullable();
			$table->tinyText('description')->nullable();
			$table->unsignedSmallInteger('is_activated')->default(1);
			$table->unsignedSmallInteger('is_deleted')->default(0);
            $table->timestamps();
        });
    }

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