comment(Inspiring::quote()); })->purpose('Display an inspiring quote'); // 每周一凌晨 2:00 准时开跑,避开流量高峰 Schedule::command('stat:tags-cloud')->weeklyOn(1, '02:00'); // 没到时间我想测试,如何直接触发 //Schedule::command('stat:order-likes')->hourly(); Schedule::command('clear_db')->dailyAt('03:00'); Schedule::command('article:sync-likes')->everyFiveMinutes(); //Artisan::command('db:reCreate {sTableName?}', function ($sTableName = null) { // // 1. 没传参数?直接亮红牌! // if (empty($sTableName)) { // $this->error('错误:必须指定要重建的表名!我可不想乱开火。'); // $this->info('用法示例:php artisan db:reCreate slave_sites'); // return; // 直接撤退,不往下走 // } // // // 2. 确定目标 // $sTable = $sTableName; // // // 3. 检查表是否存在(不存在炸个寂寞?) // if (!Schema::hasTable($sTable)) { // $this->warn("目标表 [{$sTable}] 本就不存在,但我还是会清理迁移记录并尝试重建。"); // } // // // 4. 物理抹除表 // Schema::dropIfExists($sTable); // // // 5. 撕掉迁移记录 // // 针对你的匈牙利命名或标准命名,用 snake 匹配最稳 // $sMatch = Str::snake($sTable); // DB::table('migrations')->where('migration', 'like', "%{$sMatch}%")->delete(); // // $this->warn("已爆破表及记录: {$sTable}"); // // // 6. 重新集结 // $this->comment('正在根据迁移文件重新创建表...'); // Artisan::call('migrate'); // // $this->info("表 [{$sTable}] 重建成功!任务完成!"); //})->purpose('定点爆破并重建指定的表,不带参数不动手');