[英]One of my migrations is not running with the php artisan command in 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');
}
}
我不知道为什么这不起作用。 什么想法可能会发生什么?
我有同样的问题,做了类似的事情来解决它。 这对我有用。
composer dump-autoload
- 这会将旧迁移从系统内存中取出 php artisan migrate
在命令行中php artisan migrate
文件系统基本上认为这是一个新的迁移,所以它给了它一个“新的开始”。
当您遇到迁移问题时,有时候会遇到问题
php artisan migrate:refresh
但是,如果您的迁移确实被破坏,并且有时会发生,您可能必须删除所有数据库表,然后再次运行php artisan migrate
。
使用Illuminate \\ Support \\ Facades \\ Schema;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.