<?php

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

class UpdateFactParent extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        DB::connection()->statement("UPDATE property_fact SET parent_id = 44 WHERE id = 223");
        DB::connection()->statement("UPDATE property_fact SET parent_id = 1 WHERE id = 243");
        DB::connection()->statement("UPDATE property_fact SET type = 0 WHERE id = 243");
        DB::connection()->statement("UPDATE property_fact SET parent_id = 44 WHERE id = 257");
        DB::connection()->statement("DELETE FROM offer_fact_mapping  WHERE property_fact_id = 222");
        DB::connection()->statement("DELETE FROM offer_fact_mapping  WHERE property_fact_parent_id = 222");
        DB::connection()->statement("DELETE FROM offer_fact_mapping  WHERE category_id = 222");
        DB::connection()->statement("DELETE FROM property_fact_attribute_mapping  WHERE fact_id = 222");
        DB::connection()->statement("DELETE FROM property_fact_mapping  WHERE fact_id = 222");
        DB::connection()->statement("DELETE FROM property_room_fact_mapping  WHERE fact_id = 222");
        DB::connection()->statement("DELETE FROM property_fact_locale  WHERE fact_id = 222");
        DB::connection()->statement("DELETE FROM property_fact  WHERE id = 222");

$updateData = <<<EOT
{"dashboard_section":{"general":{"title":"General","title_locale":{"tr":"Genel","en":"General"},"icon":"/img/hede.jpeg","description":"Here you can enter general information such as title, type, contact information, address and location of the property.","description_locale":{"en":"Here you can enter general information such as title, type, contact information, address and location of the property.","tr":"Tesisin adı, tipi, iletişim bilgileri, adres ve konumu gibi genel bilgileri buradan girebilirsin"},"total_childs":5,"childs":{"Content.General.Information":{"title":"Information","title_locale":{"en":"Information","tr":"Bilgi"},"profile_vote":5,"component":"Content.General.Information"},"Content.General.FacilityContact":{"title":"Facility Contact","title_locale":{"en":"Facility Contact","tr":"Tesis İletişim"},"profile_vote":5,"component":"Content.General.FacilityContact"},"Content.General.Location":{"title":"Location","title_locale":{"en":"Location","tr":"Yer"},"profile_vote":5,"component":"Content.General.Location"},"Content.General.Contacts":{"title":"Contacts","title_locale":{"en":"Contacts","tr":"İletişim"},"profile_vote":5,"component":"Content.General.Contacts"},"Content.General.Building":{"title":"Building","title_locale":{"en":"Building","tr":"Bina"},"profile_vote":5,"component":"Content.General.Building"}}},"amenities":{"title":"Amenities","title_locale":{"en":"Amenities","tr":"Kolaylıklar"},"icon":"","description":"Otel iç mekan , dış mekan , oda tipleri gibi bir çok içeriği buradan güncellemeye başkayabilirsin.","description_locale":[],"total_childs":7,"childs":{"Content.Amenities.Accommodation":{"title":"Accommodation","title_locale":{"en":"Accommodation","tr":"Konaklama"},"profile_vote":5,"component":"Content.Amenities.Accommodation"},"Content.Amenities.Services":{"title":"Services","title_locale":{"en":"Services","tr":"Hizmetler"},"profile_vote":5,"component":"Content.Amenities.Services"},"Content.Amenities.Internet":{"title":"Internet","title_locale":{"en":"Internet","tr":"Internet"},"profile_vote":5,"component":"Content.Amenities.Internet"},"Content.Amenities.BusinessCentre":{"title":"Business Centre","title_locale":{"en":"Business Centre","tr":"İş Merkezi"},"profile_vote":5,"component":"Content.Amenities.BusinessCentre"},"Content.Amenities.Disabled":{"title":"Disabled","title_locale":{"en":"Disabled","tr":"Engelli"},"profile_vote":5,"component":"Content.Amenities.Disabled"},"Content.Amenities.Transportation":{"title":"Transportation","title_locale":{"en":"Transportation","tr":"Taşımacılık"},"profile_vote":5,"component":"Content.Amenities.Transportation"},"Content.Amenities.Payment":{"title":"Payment","title_locale":{"en":"Payment","tr":"Ödeme"},"profile_vote":5,"component":"Content.Amenities.Payment"}}},"facility":{"title":"Facility","title_locale":{"en":"Facility","tr":"Tesis"},"icon":"","description":"Tesisin ödeme şekli, konaklama tipi, ulaşım hizmetleri, ortak kullanım alanları gibi genel tesis özelliklerini buradan seçebilirsin","description_locale":[],"total_childs":7,"childs":{"Content.Facility.Public":{"title":"Public","title_locale":{"en":"Public","tr":"Halk, Umumi, Kamu"},"profile_vote":5,"component":"Content.Facility.Public"},"Content.Facility.FoodDrink":{"title":"Food & Drink","title_locale":{"en":"Food & Drink","tr":"Yiyecek Içecek"},"profile_vote":5,"component":"Content.Facility.FoodDrink"},"Content.Facility.Pool":{"title":"Pool","title_locale":{"en":"Pool","tr":"Havuz"},"profile_vote":5,"component":"Content.Facility.Pool"},"Content.Facility.SpaWellness":{"title":"Spa, Wellness","title_locale":{"en":"Spa, Wellness","tr":"Spa, Sağlık"},"profile_vote":5,"component":"Content.Facility.SpaWellness"},"Content.Facility.Activities":{"title":"Activities","title_locale":{"en":"Activities","tr":"Aktiviteler"},"profile_vote":5,"component":"Content.Facility.Activities"}}},"room":{"title":"Room","title_locale":{"en":"Room","tr":"Oda"},"icon":"","description":"Enter and edit room and common amenities of rooms details here","description_locale":[],"total_childs":3,"childs":{}}},"vote_text":{"20":{"title":"Very Bad Level","title_locale":{"en":"Very Bad Level","tr":"Çok Kötü Seviye"}},"40":{"title":"Bad Level","title_locale":{"en":"Bad Level","tr":"Kötü Seviye"}},"60":{"title":"Intermediate","title_locale":{"en":"Intermediate","tr":"Orta Seviye"}},"80":{"title":"Good Level","title_locale":{"en":"Good Level","tr":"İyi Seviye"}},"100":{"title":"Very Good Level","title_locale":{"en":"Very Good Level","tr":"Çok İyi Seviye"}}}}
EOT;

        DB::table('site_config')->where('id',1)->update(['config_value_json' => $updateData]);

    }

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