M220906062158InsertQimallCrontabTask.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220906062158InsertQimallCrontabTask
  6. */
  7. class M220906062158InsertQimallCrontabTask extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $this->execute("INSERT INTO `qimall_crontab_task`( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('自动更新门店优惠券状态', 'store/coupon/update-coupon-status', 2, '0 */1 * * * *', 0, 1, 1660125107, 1660125107);");
  16. }catch (\Exception $e){
  17. var_dump($e->getMessage());
  18. }
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown()
  24. {
  25. echo "M220906062158InsertQimallCrontabTask cannot be reverted.\n";
  26. return false;
  27. }
  28. /*
  29. // Use up()/down() to run migration code without a transaction.
  30. public function up()
  31. {
  32. }
  33. public function down()
  34. {
  35. echo "M220906062158InsertQimallCrontabTask cannot be reverted.\n";
  36. return false;
  37. }
  38. */
  39. }