Laravel迁移失败

时间:2016-03-08 15:26:47

标签: php mysql database batch-file laravel-5

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'by `batch` asc, `migration` asc' at line 1 (SQL: select `migration` from `migrations` orders by `batch` asc, `migration` asc)

我正在使用Laravel 5.1,之前我已经删除了Sequel pro中的所有表格。我正在使用MySQL。问题是,每次运行PHP artisan migrate进行全新安装时,我都会一直收到此错误。我已经删除了对各种服务提供商的引用,我也没有成功地注释掉我的整个路由文件。在迁移表中只有一个迁移。

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('username');
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->string('avatar');
            $table->boolean('is_admin')->default(false);
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('users');
    }  

这是我似乎无法进行的迁移,我尝试过composer dump-autoload,php artisan migrate install我在试图弄清楚如何进一步解决这个问题时遇到了问题。有没有人有任何想法?

2 个答案:

答案 0 :(得分:0)

订购时SQL不正确:

orders by -> order by

答案 1 :(得分:0)

您的SQL错误订单

select `migration` from `migrations` orders by `batch` asc, `migration` asc