<?php

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

class CreateSigemunicipiosTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('sige.municipios', function(Blueprint $table)
		{
			$table->bigInteger('id', true);
			$table->boolean('ativo')->nullable();
			$table->bigInteger('cod_mun')->unique('municipios_cod_mun_key');
			$table->bigInteger('criado_por_id')->nullable();
			$table->dateTime('dhc')->nullable();
			$table->dateTime('dhm')->nullable();
			$table->string('macro_regiao', 50)->nullable();
			$table->bigInteger('modificado_por_id')->nullable();
			$table->bigInteger('nom_id')->nullable();
			$table->string('nom_mun', 100)->unique('municipios_nom_mun_key');
			$table->boolean('pendencias_integradas')->nullable();
			$table->string('uf', 2)->nullable();
			$table->string('origem_informacao', 20)->nullable();
			$table->string('total_cadastrados_bd')->nullable();
			$table->string('total_estimados')->nullable();
			$table->string('total_estimados_posses_a_titular')->nullable();
			$table->float('area_total_geral', 10, 0)->nullable();
			$table->float('area_total_rural', 10, 0)->nullable();
			$table->bigInteger('lotes_no_grafico')->nullable();
			$table->bigInteger('lotes_previstos')->nullable();
			$table->integer('fmp')->nullable();
			$table->integer('mf')->nullable();
			$table->integer('extratificacao0a1')->nullable();
			$table->integer('extratificacao1a4')->nullable();
			$table->integer('extratificacao4a15')->nullable();
			$table->integer('extratificacao15acima')->nullable();
			$table->string('situacao_da_arrecadacao_da_gleba', 100)->nullable();
			$table->string('situacao_do_termo_de_adesao_ppgfa', 100)->nullable();
			$table->float('area_municipal', 10, 0)->nullable();
			$table->float('area_medida', 10, 0)->nullable();
			$table->integer('total_posses_composses')->nullable();
			$table->integer('total_titulados')->nullable();
			$table->integer('total_titulos_de_dominio_entregues')->nullable();
			$table->integer('total_pendencias')->nullable();
			$table->integer('total_geral_lotes')->nullable();
			$table->integer('titulos_prontos_para_entrega')->nullable();
		});
	}


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

}
