<?php

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

class PropertyUnitFixess extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::statement("
                    ALTER TABLE `property_place_category_field_value`
            ADD COLUMN `unit_value` int UNSIGNED NULL AFTER `option_value`,
            ADD INDEX(`unit_value`) USING BTREE,
            ADD FOREIGN KEY (`unit_value`) REFERENCES `property_unit` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;
        ") ;

        DB::statement("INSERT INTO `property_unit` (`id`, `name`, `language_key`, `short_name`, `giata_id`, `status`, `created_by`, `updated_by`, `created_at`, `updated_at`) VALUES (1, 'Square Meter', NULL, 'sqm', NULL, 1, 1, 1, 1, 1),(2, 'Square Feet', NULL, 'sqf', NULL, 1, 1, 1, 1, 1),(3, 'Kilometer', NULL, 'km', NULL, 1, 1, 1, 1, 1),(4, 'Meter', NULL, 'm', NULL, 1, 1, 1, 1, 1),(5, 'Centimeter', NULL, 'cm', NULL, 1, 1, 1, 1, 1),(6, 'Inch', NULL, 'inch', NULL, 1, 1, 1, 1, 1),(7, 'Feet', NULL, 'ft', NULL, 1, 1, 1, 1, 1),(8, 'Mile', NULL, 'ml', NULL, 1, 1, 1, 1, 1),(9, 'Celcius', NULL, 'cel', NULL, 1, 1, 1, 1, 1),(10, 'Fahrenhayt', NULL, 'fah', NULL, 1, 1, 1, 1, 1),(11, 'Kelvin', NULL, 'kel', NULL, 1, 1, 1, 1, 1),(12, 'Hour', NULL, 'h', NULL, 1, 1, 1, 1, 1),(13, 'Minute', NULL, 'min', NULL, 1, 1, 1, 1, 1);") ;

    }

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