Php Illumb\Database\QueryException SQLSTATE[42S22]:未找到列:1054未知列';当前团队id';在';字段列表';
安装:将数据库从Laravel7迁移到Laravel8,Jetstream与团队(php artisan Jetstream:install Inerty--Teams),Inerty.jsPhp Illumb\Database\QueryException SQLSTATE[42S22]:未找到列:1054未知列';当前团队id';在';字段列表';,php,mysql,laravel,jetstream,Php,Mysql,Laravel,Jetstream,安装:将数据库从Laravel7迁移到Laravel8,Jetstream与团队(php artisan Jetstream:install Inerty--Teams),Inerty.js Illuminate\Database\Connection::runQueryCallback vendor/laravel/framework/src/Illuminate/Database/Connection.php:671` Illuminate\Database\QueryException
Illuminate\Database\Connection::runQueryCallback
vendor/laravel/framework/src/Illuminate/Database/Connection.php:671`
Illuminate\Database\QueryException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'current_team_id' in 'field list' (SQL: update `users` set `current_team_id` = 1, `users`.`updated_at` = 2020-10-08 21:22:00 where `id` = 5)
未找到列。您可能忘记运行 迁移。您可以使用php artisan migrate运行迁移 按下下面的按钮将尝试运行迁移 迁移并没有解决这个问题。什么时候把柱子放进去?如何修复
谢谢大家!:) 请转到phpmyadmin仪表板并查找用户表 现在在用户表中添加一个名为current_team_id的新列
谢谢请转到phpmyadmin仪表板并查找用户表 现在在用户表中添加一个名为current_team_id的新列
谢谢运行
php artisan migrate:fresh
运行php artisan migrate:fresh
您可能忘记了运行迁移。虽然迁移仅适用于新安装,但您是否正在尝试将其添加到现有的Laravel应用程序?您可能忘记运行迁移。虽然迁移仅适用于新安装,但您是否正在尝试将其添加到现有的Laravel应用程序中?这并不能回答此问题。若要评论或要求作者澄清,请在其帖子下方留下评论。-如果这是在本地,它绝对可以解决问题。但是,如果是在生产服务器上,他必须手动将该列添加到users表中。我运行了“php artisan migrate:fresh”命令,该命令对我有效,谢天谢地,这是一个全新的应用程序,我刚刚开始在本地web服务器上使用它进行开发,因此我不担心在开发周期的这一点上丢失数据。@SouthernBoy提到如果在生产服务器上,则需要手动添加此列的原因是,这将转储进行迁移的数据库中的所有数据并重新创建表。你将没有任何数据在他们,所以请备份任何数据,如果你担心之前,你开始开发工作。这并没有提供一个答案的问题。若要评论或要求作者澄清,请在其帖子下方留下评论。-如果这是在本地,它绝对可以解决问题。但是,如果是在生产服务器上,他必须手动将该列添加到users表中。我运行了“php artisan migrate:fresh”命令,该命令对我有效,谢天谢地,这是一个全新的应用程序,我刚刚开始在本地web服务器上使用它进行开发,因此我不担心在开发周期的这一点上丢失数据。@SouthernBoy提到如果在生产服务器上,则需要手动添加此列的原因是,这将转储进行迁移的数据库中的所有数据并重新创建表。你不会有任何数据在他们,所以请备份任何数据,如果你担心之前,你开始开发工作。只是想在这里进一步阐述。如果您最终想要在用户表中手动创建此列,那么以下是Laravel尝试创建列时使用的标准信息:[Name-current_team_id][Type-bigint(20)][Attributes-UNSIGNED][Null-Yes][Default-Null],只是想在这里进一步说明一下。如果您最终希望在用户表中手动创建此列,那么以下是Laravel尝试创建列时使用的标准信息:[Name-current_team_id][Type-bigint(20)][Attributes-UNSIGNED][Null-Yes][Default-Null]
/* @throws \Illuminate\Database\QueryException */
protected function runQueryCallback($query, $bindings, Closure $callback)
{
// To execute the statement, we'll simply call the callback, which will actually
// run the SQL against the PDO connection. Then we can calculate the time it
// took to execute and log the query SQL, bindings and time in our memory.
try {
$result = $callback($query, $bindings);
}
// If an exception occurs when attempting to run a query, we'll format the error
// message to include the bindings with SQL, which will make this exception a
// lot more helpful to the developer instead of just the database's errors.
catch (Exception $e) {
throw new QueryException(
$query, $this->prepareBindings($bindings), $e
);
}
return $result;
}
/**
* Log a query in the connection's query log.
*
* @param string $query
* @param array $bindings
* @param float|null $time
* @return void
*/