简体   繁体   English

Illuminate\Database\QueryException SQLSTATE[42S22]:未找到列:1054“字段列表”中的未知列“current_team_id”

[英]Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'current_team_id' in 'field list'

Setup: migrated db from laravel 7 to laravel 8, Jetstream with Teams (php artisan jetstream:install inertia --teams), inertia.js设置:将数据库从 laravel 7 迁移到 laravel 8,Jetstream with Teams (php artisan jetstream:install inertia --teams), inertia.js

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)
/* @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
 */

A column was not found You might have forgotten to run your migrations.未找到列您可能忘记运行迁移。 You can run your migrations using php artisan migrate.您可以使用 php artisan migrate 运行迁移。

Pressing the button below will try to run your migrations.按下面的按钮将尝试运行您的迁移。

Migration didn´t fix the problem.迁移没有解决问题。 Wher to put the column in?将列放在哪里? How to fix?怎么修?

Thank you guys: :)谢谢你们: :)

It looks like the migrations have missed a field.看起来迁移错过了一个领域。 Usually due to being run in the incorrect order.通常是由于以错误的顺序运行。 You can run the command below to recreate your database and it should fix the problem.您可以运行下面的命令来重新创建您的数据库,它应该可以解决问题。

WARNING警告

This command will delete all your data so only run on development.此命令将删除您的所有数据,因此仅在开发时运行。

php artisan migrate:fresh . php artisan migrate:fresh

Please goto phpmyadmin dashboard & find the users table.请转到 phpmyadmin 仪表板并找到用户表。

Now in users table add a new column named as current_team_id.现在在用户表中添加一个名为 current_team_id 的新列。

Thanks谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复“Illuminate / Database / QueryException with message'SQLSTATE [42S22]:找不到列:1054未知列”? - How to fix “Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column”? 消息为'SQLSTATE [42S22]的Illuminate / Database / QueryException:找不到列:1054未知列 - Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category_name' in 'field list' (SQL: insert into `categorie - Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'category_name' in 'field list' (SQL: insert into `categorie QueryException SQLSTATE [42S22]:找不到列:1054“ where子句”中的未知列“ customers.id” - QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'customers.id' in 'where clause' SQLSTATE [42S22]:找不到列:1054“字段列表”中的未知列“ projects_id” - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'projects_id' in 'field list' SQLSTATE [42S22]:未找到列:1054 Laravel 4 中“字段列表”中的未知列“id” - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' in laravel 4 SQLSTATE [42S22]:未找到列:1054 '字段列表'中的未知列 'id' - SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' Laravel-SQLSTATE [42S22]:找不到列:1054字段列表中的未知列 - Laravel - SQLSTATE[42S22]: Column not found: 1054 Unknown column in field list 找不到sqlstate 42s22列1054“字段列表”中的未知列 - sqlstate 42s22 column not found 1054 unknown column in 'field list' Laravel:SQLSTATE [42S22]:找不到列:1054“字段列表”中的未知列“文件” - Laravel : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'files' in 'field list'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM