use*_*337 3 php laravel laravel-4
我在Laravel 4中运行了几次迁移.我使用php artisan migrate:rollback和php artisan migrate命令填充表格.有趣的是,我的一次迁移已停止工作(无法回滚).所有其他人都工作正常.据我所知,我没有改变任何东西.
有问题的迁移命名为: 2013_06_19_050252_create_artists_table.php
它看起来像这样:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateArtistsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('artists', function(Blueprint $table) {
$table->increments('id');
$table->string('url_tag')->unique();
$table->string('username');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('artists');
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道为什么这不起作用.什么想法可能会发生什么?
use*_*723 13
我有同样的问题,做了类似的事情来解决它.这对我有用.
composer dump-autoload- 这将旧的迁移从系统的内存中取出php artisan migrate在命令行中重新运行文件系统基本上认为这是一个新的迁移,所以它给了它一个"新的开始".
当您的迁移遇到问题时,有时
php artisan migrate:refresh
Run Code Online (Sandbox Code Playgroud)
但是,如果您的迁移确实损坏了(有时会发生这种情况),您可能必须删除所有数据库表,然后php artisan migrate再次运行。