So one solution I came up with, is to add a try/catch block around the dangerous part.
php artisan migrate causes QueryException because of unknown column
Hello everyone,
so im struggeling with finding out, how to fix the "php artisan migrate" command to skip any registered commands inside the ..\Console\Kernel Class.
The scenario is as follows. I have a Console Command ChargeAdvertisement which is called periodically and has to the $commands Array inside the Kernel class.
ChargeAdvertisement is going to get all ACTIVE Advertisements, where being active is defined inside a scope function.
I want to apply a change to Advertisement.class to make it pausable. So i create a new migration file and add a column paused to the advertisements table. I am also going to change the active scope function, adding the where condition
public function scopeActive($scope){
$scope->where('published_date', '>', DB::raw('NOW()'))
->where('paused', 0); // this is new
}
Now this is where I'm getting stuck. When I push it to production and call php artisan migrate, I get an QueryException telling me that paused is not defined in advertisements table.
So ideally I want php artisan migrate to skip any Console Commands, that are defined inside the Kernel Class. Where do I do this? Or what is the alternative, besides commenting stuff out.
Please or to participate in this conversation.