dimanche 2 juillet 2017

Why Laravel keeps calling schedule() with every Artisan Command?

I have one table called user_meta and I've created one artisan command and scheduled it in kernel.php. Just after cloning the repository, when I try to run PHP artisan migrate, I get this error.

  [Illuminate\Database\QueryException]                                                                                                              
  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.dc_user_meta' doesn't exist (SQL: select * from `dc_user_met  
  a` where `meta_key` = usage_in_days)

Not only php artisan migrate but I am unable to run any artisan command at all! I don't know why PHP keeps calling schedule method every time I try to execute any artisan command.

Here in this case, What I can do to solve this error is put the cover over my logic in schedule method just like this.

if(Schema::hasTable('user_meta')){
    // Code here
}

But I don't think it's good in Long run. What's the right way to solve this error?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire