<?php

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

class CreateOrganizationsTable extends Migration
{
    public function up()
    {
        Schema::create('organizations', function(Blueprint $table)
        {
            $table->increments('id')->unsigned();
            $table->integer('parent_id')->nullable();
            $table->boolean('active');
            $table->string('title', 255);
            $table->string('description')->nullable();
            $table->integer('num_accounts')->unsigned()->default('0');
            $table->json('additional')->nullable();
            $table->timestamps();
        });
    }

    public function down()
    {
        Schema::disableForeignKeyConstraints();
        Schema::dropIfExists('organizations');
    }
}