<?php

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

class CreateVentesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ventes', function (Blueprint $table) {
            $table->id();
            $table->double('prix',10,2);
            $table->double('honoraires',10,2);
            $table->string('num_mandat');
            $table->string('type_mandat');
            $table->date('date_mandat');
            $table->boolean('passe_sous_compromis')->default(0);
            $table->integer('charges_honoraires');
            $table->double('copro_quote_part',10,2);
            $table->integer('copro_nombre_lots');
            $table->boolean('copro_proc_dilig')->default(0);
            $table->boolean('copropriete')->default(0);
            $table->unsignedBigInteger('bien_id');

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

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