问题
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?
回答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.
回答2:
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.
回答3:
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
来源:https://stackoverflow.com/questions/30393587/why-does-php-artisan-migrate-nothing