<?php

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

class CreateSocialTables extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
	    Schema::create('social_posts', function(Blueprint $table) {
			$table->increments('id');
			$table->string('title')->nullable();
			$table->text('content')->nullable();
			$table->text('images')->nullable();

			$table->integer('user_id')->nullable();
			$table->integer('number_likes')->default(0);
			$table->integer('number_comments')->default(0);

			$table->timestamps();
			$table->softDeletes();
	    });

	    Schema::create('hostel_posts', function(Blueprint $table) {
		    $table->increments('id');
		    $table->integer('social_post_id')->nullable();
		    $table->integer('hostel_id')->nullable();
		    $table->timestamps();
	    });

	    Schema::create('comments', function(Blueprint $table) {
		    $table->increments('id');
		    $table->integer('user_id')->nullable();
		    $table->text('content')->nullable();
		    $table->timestamps();
		    $table->softDeletes();
	    });

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

    }

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