<?php

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

class CreatePropertyChannelTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('property_channel', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 200);
            $table->mediumText('description');
            $table->string('type', 5);
            $table->unsignedInteger('channel_category_id');
            $table->string('country_code', 5)->nullable();
            $table->string('currency_code', 3);

            $table->tinyInteger('status')->default(1);
            $table->unsignedInteger('created_by');
            $table->unsignedInteger('updated_by');
            $table->integer('created_at');
            $table->integer('updated_at');

            $table->foreign('created_by')->references('id')->on('user');
            $table->foreign('updated_by')->references('id')->on('user');
            $table->foreign('channel_category_id')->references('id')->on('property_channel_category');
            $table->foreign('currency_code')->references('code')->on('currency');
        });
    }

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