0

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?

bestestefan
  • 852
  • 6
  • 20

1 Answers1

0

you need to rollback your previous migration or rename migration file to newer date so it's going to be loaded again, more info: https://laravel.com/docs/5.6/migrations#rolling-back-migrations

bestestefan
  • 852
  • 6
  • 20