<?php

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

class CreateMessagesTableV2 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('message_find_hostels', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('from')->nullable();
            $table->tinyInteger('type')->nullable();
            $table->string('ui_id')->nullable();
            $table->integer('conversation_id')->nullable();
            $table->double('lat')->nullable();
            $table->double('lng')->nullable();
            $table->text('preview')->nullable();
            $table->text('content')->nullable();
            $table->dateTime('read_at')->nullable();
            $table->timestamps();
        });

	    Schema::create('message_attachment_find_hostels', function (Blueprint $table) {
		    $table->bigIncrements('id');
		    $table->integer('message_id')->nullable();
		    $table->string('type')->nullable();
		    $table->string('image')->nullable();
		    $table->string('image_width')->nullable();
		    $table->string('image_height')->nullable();

		    $table->string('video')->nullable();
		    $table->string('video_duration')->nullable();
		    $table->string('video_thumbnail')->nullable();

		    $table->string('audio')->nullable();
		    $table->string('audio_duration')->nullable();
		    $table->timestamps();
	    });

	    Schema::create('conversation_find_hostels', function (Blueprint $table) {
		    $table->increments('id');
		    $table->string('name')->nullable();
		    $table->string('image')->nullable();
		    $table->string('channel', 500)->nullable();
		    $table->boolean('is_visible')->default(true);
		    $table->timestamps();
	    });

	    Schema::create('user_conversation_find_hostels', function (Blueprint $table) {
		    $table->increments('id');
		    $table->integer('conversation_id')->nullable();
		    $table->integer('user_id')->nullable();
		    $table->timestamps();
	    });
    }

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