M230620061256AlterQimallAdmin.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230620061256AlterQimallAdmin
  6. */
  7. class M230620061256AlterQimallAdmin extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="
  16. ALTER table qimall_admin add source tinyint(1) not null default 0 comment '来源类型:0:默认;1:注册';
  17. ALTER table qimall_admin add view_times int(11) not null default 0 comment '商城浏览时长';
  18. ALTER table qimall_admin add addons_view_times int(11) not null default 0 comment '应用浏览时长';
  19. ALTER TABLE qimall_admin MODIFY COLUMN expired_at BIGINT(20) NOT NULL default 0;
  20. ALTER TABLE qimall_mall MODIFY COLUMN expired_at BIGINT(20) NOT NULL default 0;
  21. ";
  22. $this->execute($sql);
  23. }catch (\Exception $e){
  24. }
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. echo "M230620061256AlterQimallAdmin cannot be reverted.\n";
  32. return false;
  33. }
  34. /*
  35. // Use up()/down() to run migration code without a transaction.
  36. public function up()
  37. {
  38. }
  39. public function down()
  40. {
  41. echo "M230620061256AlterQimallAdmin cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }