M250307114941CreateCensusMallCapitalStatistics.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M241231092053CreateUserOrderRelations
  6. */
  7. class M250307114941CreateCensusMallCapitalStatistics extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_census_mall_capital_statistics`
  16. (
  17. `id` INT AUTO_INCREMENT,
  18. `mall_id` INT UNSIGNED NOT NULL COMMENT '商城ID',
  19. `statistics_date` varchar(20) NOT NULL DEFAULT '' COMMENT '统计日期',
  20. `balance_surplus_nums` DECIMAL(14, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '余额剩余数量',
  21. `commission_surplus_nums` DECIMAL(14, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '佣金剩余数量',
  22. `score_surplus_nums` DECIMAL(14, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '积分剩余数量',
  23. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用;]',
  24. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  25. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  26. PRIMARY KEY (`id`),
  27. INDEX `idx_mall_id_statistics_date` (`mall_id`, `statistics_date`) USING BTREE
  28. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商城资金统计';
  29. SQL;
  30. $this->execute($sql);
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function safeDown()
  36. {
  37. return false;
  38. }
  39. /*
  40. // Use up()/down() to run migration code without a transaction.
  41. public function up()
  42. {
  43. }
  44. public function down()
  45. {
  46. echo "M250307105400CreateCensusMallCapitalStatistics cannot be reverted.\n";
  47. return false;
  48. }
  49. */
  50. }