6

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?

Aracthor
  • 5,757
  • 6
  • 31
  • 59
Charles Vlug
  • 79
  • 1
  • 7
  • Can you tell us what shows on the command line when you run the command? Also do these commands work? `php artisan list` and `php artisan help migrate` – Loko May 22 '15 at 09:55
  • Hi, php artisan list and php artisan help migrate work as expected: php artisan list gives a list, and starts with "Laravel Framework version 5.0.31". – Charles Vlug May 22 '15 at 10:08
  • php artisan help migrate output starts with:"Usage:" nothings seems wrong with those commands – Charles Vlug May 22 '15 at 10:09
  • What does it return when you run `php artisan migrate` ? Just the standard message that it succeeded? – Loko May 22 '15 at 10:10
  • just a blank line - no message – Charles Vlug May 22 '15 at 10:40
  • i did php artisan migrate:refresh – Charles Vlug May 22 '15 at 11:17
  • that deleted most tables. "php artisan migrate" does not rebuild it. Olse tried debugging laravel core files: in D:\phpsites\touristpreview\laravel\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\MigrateCommand.php, after $this->migrator->run($path, $pretend); and before foreach ($this->migrator->getNotes() as $note), laravel seems to have died – Charles Vlug May 22 '15 at 11:23
  • are you running the migration in the correct environment? You can supply your environment like so: `php artisan migrate --env=yourenv` – Nick May 22 '15 at 11:27
  • I have never seen this problem before +1. – Loko May 22 '15 at 11:42
  • artisan migrate --env=local does not give any output or db modifications either – Charles Vlug May 22 '15 at 12:25
  • Before i edited the datebase manually, without migrations: created columns and tables. Can that be the cause? – Charles Vlug May 22 '15 at 12:53
  • what happens if you type `php artisan migrate:install` – Alex Kyriakidis Jun 02 '15 at 20:27
  • please check the logs at /storage/logs/date-of-log.log and post it here it might give a clue of what is happening – Alleo Indong Jun 05 '15 at 01:32
  • When i run "php artisan migrate", now i get an error message: "[Symfony\Component\Debug\Exception\FatalErrorException] syntax error, unexpected 'Schema' (T_STRING), expecting function (T_FUNCTION)" – Charles Vlug Jun 06 '15 at 08:48
  • i am wondering why i did not get that error before.The error message is not verry clear. How to know in which file and line the problem is? – Charles Vlug Jun 06 '15 at 08:50
  • running "php artisan migrate:install" gives: "running "php artisan migrate:install" gives: "SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'migrations'" – Charles Vlug Jun 06 '15 at 08:52
  • This is the last part of the logs: – Charles Vlug Jun 06 '15 at 08:55

3 Answers3

1

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.

0

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.

Chetan
  • 9
  • 4
0

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
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
  • Welcome to Stack Overflow. I was having difficulty reading your answer because of the formatting, so I've edited it to, hopefully, help improve that. Please review, however, to make sure that the edits are consistent with your intent. – Jeremy Caney Oct 26 '20 at 23:06