Laravel迁移错误语法

时间:2016-05-02 15:32:34

标签: database laravel laravel-5 migration

我正在尝试迁移(更新)这个,但我不断收到此错误消息:

  

[Symfony \ Component \ Debug \ Exception \ FatalErrorException]语法错误,   意外的'>',期待'<'

    Schema::table('products', function (Blueprint $table)) {
        $table->string('XXXX', 50)->change();
        $table->string('XXXX', 50)->change();
        $table->string('XXXX', 10)->change();
        $table->String('XXXX', 100)->change();;
        $table->String('XXXX', 100)->change();
        $table->String('XXXX', 100)->change();
        $table->String('XXXX', 50)->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->String('XXXX', 100)->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->boolean('XXXX')->change();
        $table->text('XXXX')->change();
        $table->String('XXXX', 100)->change();
        $table->String('XXXX', 100)->change();
        $table->String('XXXX', 100)->change();
        $table->String('XXXX', 100)->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->tinyInteger('XXXX')->unsigned()->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->String('XXXX', 50)->change();
        $table->text('XXXX');
        $table->timestamps();
    });
}

2 个答案:

答案 0 :(得分:1)

您在第5行有;;String代替string

顺便说一句,当你运行migrate命令时,你可以从另一个文件(控制器,中间件,帮助器等)中获得错误。

答案 1 :(得分:0)

Laravel Migration Documentation中,它说使用$table->string('XXXX',50);创建VARCHAR等效列。

因此语句$table->String('XXXX', 50)->change();存在语法错误。您应该将所有String更改为string

PS :实际上在$table->String('XXXX', 100)->change();;语句中。您使用了;;,但没关系,没有错误会被报告。