ch-ru
ch-ru

Reputation: 475

Laravel 5.6 Specific Table Migration

when i run this command it says nothing to migrate

php artisan migrate --path=/database/migrations/2018_11_30_093512_create_task_user_table.php

Nothing to migrate.

And this is the task_user migration file

 */
public function up()
{
    Schema::create('task_user', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('task_id')->unsigned();
        $table->integer('user_id')->unsigned();
        $table->foreign('user_id')->references('id')->on('users');
        $table->foreign('task_id')->references('id')->on('tasks');

        $table->timestamps();
    });
}

can u help me to fix this?

Upvotes: 1

Views: 1952

Answers (2)

Ashwani Singh
Ashwani Singh

Reputation: 159

Create a sub-folder under migration folder and move/copy that specific migration file to that sub-folder and run php artisan migrate --path=/database/migrations/sub-folder/ command.It will migrate all the migration files that will be resides in that sub-folder.

Upvotes: 3

BadPiggie
BadPiggie

Reputation: 6359

It means, You can migrate a file only once, If you want to make changes, you should create another migration file then run artisan migrate command. To rollback and migrate the same file again, use migrate:refresh command like this.

php artisan migrate:refresh

Upvotes: 2

Related Questions