mercredi 6 juin 2018

dropIfExists laravel?

First to all, please forgive me for my english, it isn't my native languaje and need more practice

In my project I'm using laravel 5.5 and I have 2 differents schemas one for each database that I use in my project. Now, when I run the migration, this work perfectly, create all the tables, index, foreing keys and all that I need, but, when I need to reverse the migration, I receive an error because the table already exists

public function up()
    {
        Schema::connection('empresa')->create('almacenes', function (Blueprint $table) {
            $table->tinyIncrements('id');
            $table->string('name',30)->index();
            $table->string('address',120)->nullable();
            $table->tinyInteger('orden')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('empresa')->dropIfExists('almacenes');
    }

that is the code of my migration file, I tried differents code for the down function and nothing. Anyone can help me?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire