Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lat4732's avatar
Level 12

Column doesn't exists (It does)

Hey!

I'm getting this error from my app\Console\Kernel.php

[2022-05-30 16:52:00] local.ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "recalc_needed" does not exist

and it does exists. This error is showing only when there are no results that match ->where('recalc_needed', true). Any idea why? Here is my code

$websites = DB::table('websites')
                    ->where("recalc_needed", true)
                    ->get();

            $websites_count = $websites->count();

            if($websites_count > 0) {
                foreach($websites as $website) {
                     // some calculations and then update this specific website column
                }
           }
0 likes
43 replies
Nakov's avatar
Nakov
Best Answer
Level 73

Check your .env file and make sure you are looking at the same database as it is set in your config file.

If it clearly does exists you won't see that error.

lat4732's avatar
Level 12

@Nakov I have only 1 database for the app. It can't be looking inside another database.

lat4732's avatar
Level 12

@Nakov And the fact that it's pushing this error inside laravel.log only when there are no results is confirming that it does exist.

Nakov's avatar

@Laralex I am not sure you understand the error.

The error is on the database level, not on your results. SQLSTATE means that the database complains that you are looking for a column that does not exists on your table. So it is not on your results, but on your query.

And since you are reading the error from the log file, maybe it is an old one, before you created the column..

lat4732's avatar
Level 12

@Nakov Dude I'm telling you the column exists.

visualization1

Schema::create('websites', function (Blueprint $table) {
      $table->boolean('recalc_needed')->default(true);
}

Here is the full code

$websites = DB::table("websites")
        ->where("recalc_needed", true)
        ->get();

$websites_count = $websites->count();

if($websites_count > 0) {
    foreach($websites as $website) {

        $reviews = DB::table('reviews')
                    ->select('review_stars')
                    ->where('website_id', $website->id)
                    ->where('report_status', '!=', 3)
                    ->get();
    
        $reviews_count =  DB::table('reviews')->where('website_id', $website->id)->count();
    
        if($reviews_count > 0) {
            $stars = 0.0;
            
            foreach($reviews as $review_stars) {

                $stars = $stars + $review_stars->review_stars;
        
            }
        
            $bayesian = 7 * 3.5;
        
            $stars = round( ($stars + $bayesian) / ($reviews_count + 7) , 1 );

            DB::table('websites')->where('id', $website->id)->update([
                'web_score' => $stars,
                'recalc_needed' => false
            ]);
            
        } else {
            DB::table('websites')->where('id', $website->id)->update([
                'web_score' => '0.0',
                'recalc_needed' => false
            ]);
        }
    }
}

I'm deleting laravel.log every time after this script is being executed.

Nakov's avatar

@Laralex okay dude! remove the log file, and run the command again. Does the error still shows?

lat4732's avatar
Level 12

@Nakov Yes, it does. Lol. Running it through php artisan schedule:test doesn't push errors. But when it run alone it does.

lat4732's avatar
Level 12

@Nakov I'm sorry to say this, but you're probably my most disliked guy on laracasts. If you can help - help. If not - I have no desire to see your comments under my topics .. Pretending to be interesting and omniscient is not cool

Nakov's avatar

@Laralex I've helped you more than 100 times, and yet, I am not helping here for someone to like me.

I've tried my best if you were willing to read my messages above to help you. Not having your code and your environment is really hard for someone else to try and guess what is going on.

I explained what the error is, so a question like this "So, what could that be? @nakov" is really personal, and if I knew, I won't hide it.. That's why my initial response was "magic".

9 likes
rodrigo.pedra's avatar

@laralex

First thing: @nakov is one of the most patient and helpful members of this forum, if you got this idea somehow I would review what you could've done to contribute to it.

Second: the error is clear -- you are trying to either read or write to a column that does not exist.

The column might exists in one table, as you gave evidence,, but when saving you can be trying to write to a different table. There is no way one can tell from what you are sharing.

This is not the first time I've seen you

  • Not sharing the relevant log message, e.g. the message where it points out the exact line where the error was triggered
  • Not sharing the relevant code where the error occurred.

I know a lot of users here are worried with people copying "their codes", but, in my opinion, most of the systems here have a complexity that any of the top the responders could rebuild by themselves. And also for a top-secret project, the customer, would not allow you to seek help in a public forum anyway.

So I really don't get why most of the times the spot where the error occurs is hidden and has just a comment in place like // some calculations and then update this specific website column.

Which calculations? How the update is made? These are all relevant messages to help you out.

Another premise would be that you don't want to add noise to the code you are asking for help by hiding irrelevant parts. But to be honest, if you are needing help because you don't understand a piece of code's outcome, don't try to decide which part will be relevant to share with whom you are asking for help.

We don´t have crystal balls. Also every member is here to help on their free-time as volunteers. So be nice to people, and help us help you out by not trying to be smart when deciding which details to share.

6 likes
jlrdw's avatar

@rodrigo.pedra I agree @nakov is very patient with folks. I wish I had 1/4th of his patients. @laralex one of the replies mentioned using toSql(). I agree try that also it has helped me many times.

Also use the network tab to see what is going on.

Edit

Also a combination of:

  • dd
  • echo

To help troubleshoot.

4 likes
sr57's avatar

@laralex

There are lot of "Magic" in Laravel, the error you get is clear, if your column exists, the query (or the db) is different from what you think / share.

Show you full logs.

automica's avatar

@laralex with your missing column - did you add it to a migration or directly to the db table?

as for code, i've taken the liberty to do a bit of a refactor as you dont need to make calls to get reviews if you have already loaded all websites. Use the eloquent relationship:

$websites = Website::where("recalc_needed", true)
    ->with('reviews')
    ->get();

if ($websites->count()) {
    foreach ($websites as $website) {

        $reviews = $website
            ->reviews()
            ->select('review_stars')
            ->where('report_status', '!=', 3)
            ->get();

        $reviews_count = $website->reviews()->count();

        if ($reviews_count > 0) {
            $stars = $reviews->sum('review_stars');

            $bayesian = 7 * 3.5;

            $stars = round(($stars + $bayesian) / ($reviews_count + 7), 1);
        }

        $website->update([
            'web_score' => $stars ?? '0.0',
            'recalc_needed' => false
        ]);
    }
}
click's avatar

@automica your code will have unexpected results as $stars is never set to null.

If website 1 has $stars = 4 and website 2 has $reviews_count === 0 then website 2 will also have $stars = 4.

automica's avatar

@click good spot. in that case, @laralex should set web_score as default 0. and then no need to save web_score if there are no reviews

$websites = Website::where("recalc_needed", true)
    ->with('reviews')
    ->get();

if ($websites->count()) {
    foreach ($websites as $website) {

        $reviews = $website
            ->reviews()
            ->select('review_stars')
            ->where('report_status', '!=', 3)
            ->get();

        $reviews_count = $website->reviews()->count();

        if ($reviews_count > 0) {
            $stars = $reviews->sum('review_stars');

            $bayesian = 7 * 3.5;

            $website->update([
                'web_score' => round(($stars + $bayesian) / ($reviews_count + 7), 1)]);
        }

        $website->update([
            'recalc_needed' => false
        ]);
    }
}
click's avatar

Btw, your example code of the "Schema::create" does not seem to match your screenshot. Your Schema::create() creates a table with only 1 column, while your screenshot seem to have more than 1 column.

If you want to add a column to an existing table you should use Schema::table('websites', ... instead of Schema::create('websites', ...

However, this does not explain what you experience.

So back the problem, if I understand your first post correctly you only get an error when it is actually trying to do an update?

Can you form this works?

DB::table("websites")->where("recalc_needed", true)->get();

And what about this:

DB::table("websites")->update(["recalc_needed" => true]);
Tray2's avatar

Why the heck are you storing the rating of the site inside another table? You should calculate that on the fly instead. Single source of truth. If you do it that way your don't need that column that mysql tells you that you are missing in the table you are querying.

I suggest you tack on ->toSql() on your query instead of ->get()` and then run the generated query in your database directly, and see what it complains about.

2 likes
click's avatar

@Tray2 storing a result of a calculation in a table could be a reason to simplify and optimize your queries.

As usual, the answer is "it depends", but these would be perfect valid reasons;

  1. Sorting, imagine you have a list of 1000 websites with 10.000 votes per website. If you want to show the list of website ordered by their rate you don't want to recalculate this on every page as you would need to do this for all 1000 websites to be able to know which one is #1.

  2. Some sort of caching, if you have 10.000 requests and your votes are not updating that frequently it is a waste to recalculate it every time. However, using some sort of Cache would work perfectly fine here as well.

2 likes
Tray2's avatar

@click I see your point, and agree that in some edge cases it might be a good idea to store calculated data in a table, however it's most of the time better to do the calculation on the fly in the database. If you use the proper indexes it should be fast enough. The query and its result is usually cached in the RDBMS so it would be faster the second time around. However like you said it depends. I would use stored calculations as a last resort, and not my first option.

2 likes
Snapey's avatar

can you share the full error message and point to the line that throws the error.

1 like
sr57's avatar

@laralex

I like this forum because there is no "downvote", but hopefully there is like , that's much better.

1 like
lat4732's avatar
Level 12

Thank you all for the responses. Looks like you guys don't understand that there is an existing column with this name and if I move this code to a simple GET route and access the route - the code is running perfectly with no errors. The problem comes when the code runs from app\Console\Kernel.php. This is the pure SQL that I'm getting from

DB::table("websites")->where("recalc_needed", true)->toSql();
select * from "websites" where "recalc_needed" = ?

and If I run that same query directly in the database after replacing ? with TRUE/FALSE I'm getting correct results and no errors are shown. I migrate:fresh-ed many times so I can make sure that It's creating the column and it is! Also cleared the cache like 10 times so I can make sure again that everything is happening at the current time and nothing is cached. (I'm pretty sure there is no way Laravel to cache the tables structures but still..)

sr57's avatar

@laralex

I would have started by apologizing to @nakov

That said, I think that most of the readers understood what you wrote, there is a field 'recalc_needed'

You answered to @nakov that it's the same db.

Can you double check?

Then we have to explain what's @nakov called Magic ...

First, as I and @snapey wrote, please share the full error logs.

lat4732's avatar
Level 12

@nakov Maybe I went a little too far with my words. I apologize. No bad feelings, man :)

Here is the full error

[2022-06-02 10:45:00] local.ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "recalc_needed" does not exist
LINE 1: select * from "websites" where "recalc_needed" = 
                                       ^ (SQL: select * from "websites" where "recalc_needed" = 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ (SQL: select * from \"websites\" where \"recalc_needed\" = 1) at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#8 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#22 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#24 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 {main}

[previous exception] [object] (PDOException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:373)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(373): PDOStatement->execute()
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(705): Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from \"...', Array)
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#6 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#22 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#24 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#25 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 {main}
"} 
[2022-06-02 10:45:00] local.ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "recalc_needed" does not exist
LINE 1: select * from "websites" where "recalc_needed" = 
                                       ^ (SQL: select * from "websites" where "recalc_needed" = 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ (SQL: select * from \"websites\" where \"recalc_needed\" = 1) at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#8 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#22 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#24 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 {main}

[previous exception] [object] (PDOException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:373)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(373): PDOStatement->execute()
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(705): Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from \"...', Array)
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#6 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#22 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#24 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#25 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 {main}
"} 
[2022-06-02 10:45:00] local.ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "recalc_needed" does not exist
LINE 1: select * from "websites" where "recalc_needed" = 
                                       ^ (SQL: select * from "websites" where "recalc_needed" = 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ (SQL: select * from \"websites\" where \"recalc_needed\" = 1) at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#8 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#22 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#24 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 {main}

[previous exception] [object] (PDOException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:373)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(373): PDOStatement->execute()
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(705): Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from \"...', Array)
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#6 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#22 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#24 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#25 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 {main}
"} 
[2022-06-02 10:45:00] local.ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR:  column "recalc_needed" does not exist
LINE 1: select * from "websites" where "recalc_needed" = 
                                       ^ (SQL: select * from "websites" where "recalc_needed" = 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ (SQL: select * from \"websites\" where \"recalc_needed\" = 1) at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#8 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#22 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#24 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 {main}

[previous exception] [object] (PDOException(code: 42703): SQLSTATE[42703]: Undefined column: 7 ERROR:  column \"recalc_needed\" does not exist
LINE 1: select * from \"websites\" where \"recalc_needed\" = 
                                       ^ at /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:373)
[stacktrace]
#0 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(373): PDOStatement->execute()
#1 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(705): Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from \"...', Array)
#2 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(672): Illuminate\Database\Connection->runQueryCallback('select * from \"...', Array, Object(Closure))
#3 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Connection.php(376): Illuminate\Database\Connection->run('select * from \"...', Array, Object(Closure))
#4 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2414): Illuminate\Database\Connection->select('select * from \"...', Array, true)
#5 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2402): Illuminate\Database\Query\Builder->runSelect()
#6 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2936): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2403): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 /home/userdev/public_html/app/Console/Kernel.php(39): Illuminate\Database\Query\Builder->get()
#9 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Kernel->App\Console\{closure}()
#10 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Closure->__invoke()
#11 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#13 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#14 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#15 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/CallbackEvent.php(79): Illuminate\Container\Container->call(Array, Array)
#16 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(143): Illuminate\Console\Scheduling\CallbackEvent->run(Object(Illuminate\Foundation\Application))
#17 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(102): Illuminate\Console\Scheduling\ScheduleRunCommand->runEvent(Object(Illuminate\Console\Scheduling\CallbackEvent))
#18 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Console\Scheduling\ScheduleRunCommand->handle(Object(Illuminate\Console\Scheduling\Schedule), Object(Illuminate\Events\Dispatcher), Object(NunoMaduro\Collision\Adapters\Laravel\ExceptionHandler))
#19 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#21 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#22 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#23 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#24 /home/userdev/public_html/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#25 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 /home/userdev/public_html/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /home/userdev/public_html/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Console\Scheduling\ScheduleRunCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /home/userdev/public_html/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /home/userdev/public_html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /home/userdev/public_html/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 {main}
"} 

I'm sure that I'm checking in the right database. Everything is on 1 database and websites table is not used only in these 30 lines of code. The table is used everywhere in the site. And this code was working before I make these changes to the websites table. The changes were that I added this recalc_needed column for optimization because previously the script was getting all the websites from websites table no matter if they need recalculation or not. So I decided to add this boolean column to somehow tell the script which websites needs recalculation.

Nakov's avatar

@laralex no worries.

If this is the way you are adding the column to the database:

Schema::create('websites', function (Blueprint $table) {
      $table->boolean('recalc_needed')->default(true);
}

then that's wrong.. It should be

Schema::table('websites', function (Blueprint $table) {
      $table->boolean('recalc_needed')->default(true);
}

because you are not creating a table again but you are adding a new column.

  1. Now what I would do is rename the column to test instead of recalc_needed in the migration file. And change it in the script.

  2. Try running a query in your Kernel file to another table in the database, does that work? If it does, then most probably is something with your migrations or database connection.

1 like
lat4732's avatar
Level 12

@Nakov But wait a second. I think there is some misunderstanding. I'm not adding the column separately in another migration file. I just added it in the websites migration file and ran php artisan migrate:fresh ... The migration file looks like this at the current time:

....create_websites_table.php

    public function up()
    {
        Schema::create('websites', function (Blueprint $table) {
            $table->id();
            $table->text('web_seo_url')->unique();
            $table->text('web_name');
            $table->text('web_link')->unique();
            $table->text('web_description')->nullable();
            $table->string('web_score')->default("0.0");
            $table->string('logo_path')->unique()->nullable();
            $table->unsignedBigInteger('web_category');
            $table->integer('claimed')->default(0);
            $table->boolean('recalc_needed')->default(true);
            $table->timestamps();
            $table->foreign('web_category')->references('id')->on('categories');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('websites');
    }

Am I not understanding properly again? Sorry if so.

Nakov's avatar

@Laralex Okay, you just shared that part above, so that's why I said if that's the way then that's wrong. Then try my other suggestions.. Rename the column, will the error be the same ?

lat4732's avatar
Level 12

@Nakov I tried renaming it before I post this thread. Previously it was named "webscore_recalculation_needed" and I was getting the same error for not existing column. Then I renamed it to "recalc_needed" and the error continued showing. After that I posted this thread.

Nakov's avatar

@Laralex and did you tried my other suggestion? Trying any other table? Any other column on the same table?

What will this one return:

DB::table("websites")->first();

Do you see the column in the results?

1 like
sr57's avatar

@laralex

Just before your query run this one and share the result

 DB::select("SELECT * FROM websites LIMIT 1");

PS : insert one record before

1 like
lat4732's avatar
Level 12

@nakov @sr57 Okay guys, this is getting really, really interesting. I'm facing something like 2 different records from something like 2 different databases? What on earth? Once its showing an actual record from the actual database, once its showing a record that says created_at:2022-05-16 which is like 2 weeks ago where the recalc_needed or webscore_recalculation_needed doesn't even exist. What the hell? I think your help ends here as its a problem related to our database. Did I said that we're using DO cluster?

But the more interesting part is that I created a test route with output:

return DB::select("SELECT * FROM websites LIMIT 1");

and it is actually showing an actual data. There is no different data than expected like above (in kernel)? I'm so confused

Snapey's avatar

@Laralex no you didn't say. The implication is that you are working locally since you are changing the database design so would seem to be in development not production

1 like
sr57's avatar

@Laralex

First @nakov question ...

Apologies would be not enough, some beers would be welcome :-)

1 like
lat4732's avatar
Level 12

@Snapey But wait a second.. What has the database data to do with the environment of the app?

@sr57 Sure.. I'm sending both of you 1 stack of beers :) @nakov

lat4732's avatar
Level 12

@sr57 @nakov @snapey but guys I'm still getting the same error. I changed the APP_ENV to production but same error occur. I'm saying again I use only 1 database which I connect with through HeidiSQL. I can see the live data in it and there is no data matching the one that I get when I

DB::select("SELECT * FROM websites LIMIT 1");

What's happening, any ideas? Why is it getting old data from 2 weeks ago? I can't get it..

sr57's avatar

@laralex

Magic is back :-)

Different db connections from different env?

lat4732's avatar
Level 12

@sr57 I have just 1 .env file which contains only the database connection details that I'm connecting to through HeidiSQL. Is it possible somehow Laravel cached an old version of the .env file and for some reason using this old .env file for the cron jobs? I ran php artisan optimize:clear like 100 times in the past week.

sr57's avatar

@laralex

You can have several connections defined in config/database.php.

A queue worker can cache the config

...

1 like
Jc_dev's avatar

I have a same error, check if your column in PG have space in his name..

Please or to participate in this conversation.