M240204093537FrozenFundClearLog.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace addons\DoubleCopy\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240204093537FrozenFundClearLog
  6. */
  7. class M240204093537FrozenFundClearLog extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_double_copy_frozen_fund_clear_log` (
  15. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城id',
  17. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
  18. `clear_num` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '操作金额',
  19. `reward_currency` varchar(32) NOT NULL DEFAULT 'commission' COMMENT '奖励类型:佣金-commission,积分-score',
  20. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  21. `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间戳',
  22. `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
  23. PRIMARY KEY (`id`) USING BTREE,
  24. KEY `idx_mall_user` (`mall_id`,`user_id`) USING BTREE
  25. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='二二复制冻结基金清零记录表';";
  26. $this->execute($sql);
  27. $sql = "ALTER TABLE `qimall_addons_double_copy_pool_source` ADD COLUMN `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注';";
  28. $this->execute($sql);
  29. $sql = "INSERT INTO `qimall_crontab_task` ( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at` ) VALUES ( '二二复制冻结基金每月清零', 'double-copy/frozen-fund/clear', '2', '0 1 0 * * *', '0', '1', '1708418352', '1708418352' );";
  30. $this->execute($sql);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function safeDown()
  36. {
  37. echo "M240204093537FrozenFundClearLog cannot be reverted.\n";
  38. return false;
  39. }
  40. /*
  41. // Use up()/down() to run migration code without a transaction.
  42. public function up()
  43. {
  44. }
  45. public function down()
  46. {
  47. echo "M240204093537FrozenFundClearLog cannot be reverted.\n";
  48. return false;
  49. }
  50. */
  51. }