mardi 25 août 2020

Laravel Nothing to Migrate

I created migration on my Laravel project using command php artisan make:migration migration_name and php artisan make:model ModelName -mcr.

When I run php artisan migrate the output is nothing to migrate.

I check my database, there is only migration table which has no row, even user table that comes from Laravel does not created.

This is the environment that I use to run Laravel using XAMPP

  • Laravel 7.24
  • Apache/2.4.39 (Win64)
  • PHP 7.3.7
  • MariaDB 10.3.16

This is the migration code

<?php

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

class CreateCategoryTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('category', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
        });
    }

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

I already try these but found no luck :

  • Run composer dump-autoload
  • Run php artisan migrate:reset -> nothing to rollback
  • Run php artisan migrate:fresh-> dropped all table successfully, migration table created successfully ,nothing to migrate
  • Run php artisan migrate --path="/database/migrations/" -> nothing to migrate
  • Run php artisan migrate:status -> no migrations found


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire