<?php

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

class CreateParticipationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('participations', function (Blueprint $table) {
            $table->id();
            $table->foreignId('forum_id');
            $table->foreignId('commune_id');
            $table->longText('messages')->nullable();
            $table->longText('rapports')->nullable();
            $table->longText('engagements')->nullable();
            $table->string('pf_name', 64)->nullable();
            $table->string('pf_poste', 255)->nullable();
            $table->string('pf_phone', 32)->nullable();
            $table->string('pf_email', 32)->nullable();
            $table->boolean('confirmed')->default(false);
            $table->timestamps();

            $table->index(['forum_id', 'commune_id']);
        });
    }

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