Laravel Version: 5.7
PHP Version: 7.2.9
Database Driver & Version: mysql
Description Last migration creates table but is not registered in the migration table
Steps To Reproduce
I have 14 migrations .
If I run php artisan migrate
The table is created but not registered as a run migration
I've dropped the homestead database a couple of times
eventually when I want to refresh ,rollback or migrate for developement purposes I get this error telling me the table exists but however is not on the migration
vagrant@kakbima:~/code$ php artisan migrate
Migrating: 2018_12_13_091954_create_product_subcategories_table
Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'product_subcategories' already exists (SQL: create table product_subcategories (id int unsigned not null auto_increment primary key, name varchar(191) not null, product_category_id int unsigned not null, created_at timestamp null, updated_at timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
public function up()
{
Schema::create('product_subcategories', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->unsignedInteger('product_category_id');
$table->foreign('product_category_id')
->references('id')->on('product_categories')
->onUpdate('cascade')
->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('SET FOREIGN_KEY_CHECKS = 0');
Schema::dropIfExists('product_subcategories');
DB::statement('SET FOREIGN_KEY_CHECKS = 1');
}