<?php

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

class AlterTableFichier extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('fichiers', function($table) {
            // On supprime le champs type -> ne sert plus à rien
            $table->dropColumn('type');
            // On ajoute le champ commentaire du fichier
            $table->unsignedInteger('upload_by')->after('url');
            $table->text('commentaire')->nullable()->after('upload_by');

            $table->foreign('upload_by')->references('id')->on('users');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
    }
}
