M220914072538CreateQimallAddonsBossGoodsStatistics.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace addons\Boss\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220914072538CreateQimallAddonsBossGoodsStatistics
  6. */
  7. class M220914072538CreateQimallAddonsBossGoodsStatistics extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_boss_goods_statistics` (
  15. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  17. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
  18. `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品ID',
  19. `buy_num` int(10) NOT NULL DEFAULT '0' COMMENT '购买数量',
  20. `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '实付金额',
  21. `date` int(10) NOT NULL DEFAULT '0' COMMENT '日期',
  22. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  23. `created_at` int(10) DEFAULT '0' COMMENT '创建时间',
  24. `updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
  25. PRIMARY KEY (`id`) USING BTREE,
  26. KEY `idx_user_goods_date` (`user_id`,`goods_id`,`date`) USING BTREE
  27. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='用户购买商品统计';";
  28. $this->execute($sql);
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function safeDown()
  34. {
  35. echo "M220914072538QimallAddonsBossGoodsStatistics cannot be reverted.\n";
  36. return false;
  37. }
  38. /*
  39. // Use up()/down() to run migration code without a transaction.
  40. public function up()
  41. {
  42. }
  43. public function down()
  44. {
  45. echo "M220914072538QimallAddonsBossGoodsStatistics cannot be reverted.\n";
  46. return false;
  47. }
  48. */
  49. }