M250117094321ChackItemTradeType.php 802 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250117094321ChackItemTradeType
  6. */
  7. class M250117094321ChackItemTradeType extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $res = \Yii::$app->db->schema->getTableSchema("qimall_payment_trade_item", true);
  15. if (!$res->getColumn('trade_type')) {
  16. $sql = "ALTER TABLE `qimall_payment_trade_item` ADD COLUMN `trade_type` varchar(100) NOT NULL DEFAULT '' COMMENT '聚合支付具体的支付方式(如汇聚-微信,汇聚-支付宝)'";
  17. $this->execute($sql);
  18. }
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public function safeDown()
  24. {
  25. echo "M250117094321ChackItemTradeType cannot be reverted.\n";
  26. return false;
  27. }
  28. }