Charles Vlug
Charles Vlug

Reputation: 79

Why does php artisan migrate nothing?

Running "php artisan migrate" does nothing: no database modifications, no message(olso no "nothing to migrate"), no error.

No records are being added to table migrations as well.

Previously, the command "php artisan migrate" was working fine.

One of the migration files in folder database/migrations has this content:

<?php

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

class VidsTableEdit14 extends Migration {

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
            $table->integer('test');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('vids', function(Blueprint $table)
        {
            //
        });
    }

}

How to make "php artisan migrate" working?

Upvotes: 6

Views: 2980

Answers (3)

user14520954
user14520954

Reputation: 1

Error:

SQLSTATE[42S01] 
Migrating: 2014_10_12_000000_create_users_table

   Illuminate\Database\QueryException 
-------------
[php artisan migrate] 

Solution: Go to:

app\Http\Providers\AppServiceProvider
import ( use Illuminate\Support\Facades\Schema; ) 

And, inside the register() function, insert this code:

public function register()
{
     Schema::defaultStringLength(191); 
}

Then run:

php artisan migrate:fresh

Upvotes: 0

DustBowlDarrell
DustBowlDarrell

Reputation: 11

If the migration stops working suddenly there is probably a syntax error somewhere in one of your migrations. If you suddenly get a class not found error be suspicious of a syntax error.

Upvotes: 1

Chetan
Chetan

Reputation: 9

This same happened me, when I was trying to add soft delete to my table.

I created the migration and in the Schema::table function I typed "$table->softDelete();". Instead of

$table->softDeletes();

Notice the 's' for plural, I tried running migration and didn't get any error or message. I made it plural and it worked.

And I noticed that you didn't make down function().Try adding:

Schema::drop('vids');

And run the migration again.

Upvotes: 0

Related Questions