laravel / lumen-framework

The Laravel Lumen Framework.
https://lumen.laravel.com
MIT License
1.48k stars 416 forks source link

artisan migrate command doesn't run with mysql-schema.dump file #1213

Closed binarweb closed 2 years ago

binarweb commented 2 years ago

Description:

Running the artisan migrate drops the required migrations table prior to running the actual migrations.

The problem is the mysql-schema.dump file. If I rename/remove this file, the migrations run ok.

Steps To Reproduce:

  1. create the migration table artisan migrate:install
  2. create a migration
<?php

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

class CreateCurrenciesTable extends Migration
{
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->id();
            $table->string('name', 255);
            $table->string('short', 5);
        });
    }

    public function down()
    {
        Schema::dropIfExists('posts');
    }
}
  1. run artisan migrate

The following error appears:

Loading stored database schema: /var/www/html/blog/database/schema/mysql-schema.dump
Loaded stored database schema. (17.62ms)

In Connection.php line 712:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.migrations' doesn't exist (SQL: select `migration` from `migrations` order by `batch` asc,  
`migration` asc)                                                                                                                                                   

In Connection.php line 368:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blog.migrations' doesn't exist
driesvints commented 2 years ago

This isn't supported in lumen. Please use Laravel if you need this. Thanks.

binarweb commented 2 years ago

What is not supported in Lumen?

driesvints commented 2 years ago

Dumping migrations

binarweb commented 2 years ago

Now I see that the mysql-schema.dump does not exist in original laravel/lumen repo.

How did it end up in my project then?