Setup: migrated db from laravel 7 to 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.

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! :)

2

There are 2 answers

1
Waqar Akram On

Please goto phpmyadmin dashboard & find the users table.

Now in users table add a new column named as current_team_id.

Thanks

4
SouthernBoy On

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.