<?php

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

class CreateWebsiteObjectsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('website_objects', function(Blueprint $table)
		{
			$table->increments('website_object_id');
			$table->integer('object_id')->unsigned();
			$table->string('object_type', 50);
			$table->integer('parent_id')->unsigned()->nullable()->index('FK_website_objects_2');
			$table->string('content_type', 50);
			$table->string('slug', 150)->unique('idx_website_objects_slug');
			$table->string('uri')->nullable();
			$table->string('template')->nullable();
			$table->string('status', 20);
			$table->integer('position')->unsigned()->nullable();
			$table->timestamps();
			$table->unique(['object_id','object_type'], 'idx_website_object');
		});
	}


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

}
