M230328092048AlterQimallUserStatisticsTotal.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230328092048AlterQimallUserStatisticsTotal
  6. */
  7. class M230328092048AlterQimallUserStatisticsTotal extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = "ALTER TABLE qimall_user_statistics_total add share_nums bigint(20) not null default 0 COMMENT '分享次数';
  16. ALTER TABLE qimall_user_statistics_total add visit_nums bigint(20) not null default 0 COMMENT '访问次数';";
  17. $this->execute($sql);
  18. } catch (\Exception $e) {
  19. }
  20. }
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public function safeDown()
  25. {
  26. echo "M230328092048AlterQimallUserStatisticsTotal 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 "M230328092048AlterQimallUserStatisticsTotal cannot be reverted.\n";
  37. return false;
  38. }
  39. */
  40. }