gpt4 book ai didi

php - Laravel 迁移失败

转载 作者:行者123 更新时间:2023-11-29 21:16:51 25 4
gpt4 key购买 nike

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 我在尝试找出如何进一步解决此问题时遇到问题。有人有什么想法吗?

最佳答案

SQL 的 order by 不正确:

orders by -> order by

关于php - Laravel 迁移失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35871382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com