M221208033824AddTradeOrderNoToPaymentRefund.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. *
  6. * Class M221208033824AddTradeOrderNoToPaymentRefund
  7. */
  8. class M221208033824AddTradeOrderNoToPaymentRefund extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. $res = \Yii::$app->db->schema->getTableSchema("qimall_payment_refund",true);
  16. if(!$res->getColumn('trade_order_no')){
  17. $sql = "ALTER TABLE `qimall_payment_refund`
  18. ADD COLUMN `trade_order_no` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '交易流水订单号';";
  19. $this->execute($sql);
  20. $sql = "INSERT INTO `qimall_global_var_map` ( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at` ) VALUES ( 'GroupBuy', '拼团', 'FromTypeMap', '1', '1', '1654569888', '1654569888' );";
  21. $this->execute($sql);
  22. }
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function safeDown()
  28. {
  29. echo "M221208033824AddTradeOrderNoToPaymentRefund cannot be reverted.\n";
  30. return false;
  31. }
  32. /*
  33. // Use up()/down() to run migration code without a transaction.
  34. public function up()
  35. {
  36. }
  37. public function down()
  38. {
  39. echo "M221208033824AddTradeOrderNoToPaymentRefund cannot be reverted.\n";
  40. return false;
  41. }
  42. */
  43. }