Upgrade.php 807 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace addons\Wechat;
  3. use Yii;
  4. use common\components\Migration;
  5. use common\interfaces\AddonWidget;
  6. /**
  7. * 升级数据库
  8. *
  9. * Class Upgrade
  10. * @package addons\Wechat
  11. */
  12. class Upgrade extends Migration implements AddonWidget
  13. {
  14. /**
  15. * @var array
  16. */
  17. public $versions = [
  18. '1.0.0', // 默认版本
  19. '1.0.1',
  20. ];
  21. /**
  22. * @param $addon
  23. * @return mixed|void
  24. * @throws \yii\db\Exception
  25. */
  26. public function run($addon)
  27. {
  28. switch ($addon->version) {
  29. case '1.0.1' :
  30. $this->alterColumn('{{%addon_wechat_attachment_news}}', 'thumb_url', $this->string(500));
  31. $this->alterColumn('{{%addon_wechat_attachment_news}}', 'media_url', $this->string(500));
  32. break;
  33. }
  34. }
  35. }
粤ICP备19079148号