<?php

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

class CreateLocationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('locations', function (Blueprint $table) {
            $table->id();
            $table->double('depot_garantie',10,2);
            $table->double('honoraire_location_locataire',10,2);
            $table->double('honoraire_etat_locataire',10,2);
            $table->double('honoraire_total_locataire',10,2);
            $table->double('complement_loyer',10,2);
            $table->integer('modalite_charge');
            $table->double('charges',10,2);
            $table->string('type_mandat');
            $table->string('num_mandat');
            $table->date('date_mandat');
            $table->string('acte_propriete');
            $table->date('libre_le')->nullable();
            $table->unsignedBigInteger('bien_id');

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

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