2
votes

It all started with the fact that i created new migration

    /**
 * Run the migrations.
 *
 * @return void
 */
public function up()
{
    Schema::table('a_delivery_pec_pickup_coef', function(Blueprint $table) {
        $table->primary(['location_id', 'weight_limit'], 'location_id_weight_limit_index');
    });
}

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::table('a_delivery_pec_pickup_coef', function(Blueprint $table) {
        $table->dropIndex(['location_id_weight_limit_index']);
    });
}

After i executed command

php artisan migrate:refresh --seed

and got error

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'delivery_update. a_delivery_pec_delivery_ranges' doesn't exist (SQL: select * from a_delive ry_pec_delivery_ranges)

Then something very strange began. I could not execute any commands becouse got same error.

php artisan migrate:rollback

php artisan migrate

php artisan list

application just stopped working. Main page stopped opening. I go into connection.php file and did

error_reporting(E_ALL);
ini_set('display_errors', 1);

Main page show same error, but insead table "a_delivery_pec_delivery_ranges" i saw another table.

Next i created table "a_delivery_pec_delivery_ranges" manually and the error was gone. BUT when i executed

php artisan migrate

i got error

Base table or view already exists: 1050 Table 'a_delivery_ pec_delivery_ranges' already exists

Now I'm in a deadlock situation becouse if i remove table 'a_delivery_ pec_delivery_ranges' my application not working with first error.

But if i add this table (also i tried add migration name into migrations table) and try

php artisan migrate

or

php artisan migrate:rollback

i get 'a_delivery_pec_delivery_ranges' already exists! Also i tried comment "up"-method in this migration

 public function up()
{
    Schema::create('a_delivery_pec_delivery_ranges', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('weight');
        $table->float('volume');
        $table->float('length');
    });
}

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

but then i can't create this table!

Also i can't understand why it is this table! I delete each table in turn and and nothing happens. But if i remove this table my application die!


up. Problem is is relevant

2
Try php artisan migrate:reset and then php artisan migrate --seedteeyo
Coppy and paste Schema::dropIfExists('a_delivery_pec_delivery_ranges'); in the up method before Schema::create ... and do php artisan migrate:resetMaraboc
again error Base table or view already exists: 1050 Table 'a_delivery_ pec_delivery_ranges' already existsViktor
"Coppy and paste Schema::dropIfExists('a_delivery_pec_delivery_ranges'); in the up method before Schema::create ... and do php artisan migrate:reset" this is doesn't remove that tableViktor

2 Answers

0
votes
  • What's the class (and file) name of this migration?
  • Did you mabe use the same class name in another migration file? I had this error once because of copy&paste lazyness ^^
  • Can you show the last files that made it through the migration, like which seeding was executed and which one doesnt?

Sorry for making an answer, I am 6 points shy of being able to comment :(

0
votes

The problem was that in my app/Console/Commands/MyCommand.php in __construct was next code

PecDeliveryRange::all();