M230517160536InsertQimallTask.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230517160536InsertQimallTask
  6. */
  7. class M230517160536InsertQimallTask extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="INSERT INTO `qimall_crontab_task`(`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('定时清理冗余的定时任务记录', 'clear-crontab/execute', 2, '0 0 1 * * * *', 0, 1, 1638599725, 1660124907);";
  16. $this->execute($sql);
  17. }catch (\Exception $e){
  18. \Yii::error('M230517160536InsertQimallTask文件迁移执行失败');
  19. }
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M230517160536InsertQimallTask cannot be reverted.\n";
  27. return false;
  28. }
  29. /*
  30. // Use up()/down() to run migration code without a transaction.
  31. public function up()
  32. {
  33. }
  34. public function down()
  35. {
  36. echo "M230517160536InsertQimallTask cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }