<?php

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

class CreateAppartementsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('appartements', function (Blueprint $table) {
            $table->id();
            $table->integer('surface_habitable');
            $table->integer('surface_sejour');
            $table->integer('nbre_pieces');
            $table->integer('nbre_chambres');
            $table->integer('annee_construction')->nullable();
            $table->integer('nbre_niveaux');
            $table->integer('categorie');
            $table->integer('etat_general');
            $table->integer('nbre_salle_bain');
            $table->boolean('meuble')->default(0);
            $table->string('type_habitat');
            $table->string('regime_juridique');
            $table->date('date_permis_construire');
            $table->boolean('immeuble_vingt');
            $table->unsignedBigInteger('bien_id');

            $table->foreign('bien_id')->references('id')->on('biens');
            $table->timestamps();
        });
    }

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