<?php

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

class UpdatePriceTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('prices', function (Blueprint $table) {
            if (Schema::hasColumn('prices', 'min_price')) {
                $table->renameColumn('min_space', 'min_space_old');
                $table->renameColumn('max_space', 'max_space_old');
                $table->renameColumn('min_price', 'min_price_old');
                $table->renameColumn('max_price', 'max_price_old');
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
