M230203072720AddColumnIntoQimallAddonsStoreCate.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Exception;
  4. use yii\db\Migration;
  5. /**
  6. * Class M230203072720AddColumnIntoQimallAddonsStoreCate
  7. */
  8. class M230203072720AddColumnIntoQimallAddonsStoreCate extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $sql="ALTER TABLE qimall_addons_store_cate add is_collect_service_fee tinyint(1) not null default 0 comment '是否收取服务费:1是;0:否';";
  17. $this->execute($sql);
  18. $sql="ALTER TABLE qimall_addons_store_cate add collect_service_fee decimal(12,2) not null default 0 comment '服务费比例';";
  19. $this->execute($sql);
  20. }catch (Exception $e){
  21. }
  22. }
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public function safeDown()
  27. {
  28. echo "M230203072720AddColumnIntoQimallAddonsStoreCate cannot be reverted.\n";
  29. return false;
  30. }
  31. /*
  32. // Use up()/down() to run migration code without a transaction.
  33. public function up()
  34. {
  35. }
  36. public function down()
  37. {
  38. echo "M230203072720AddColumnIntoQimallAddonsStoreCate cannot be reverted.\n";
  39. return false;
  40. }
  41. */
  42. }