M220919093212AddColumn.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220919093212AddFillMinColumnToQimallAddonsCloudStockLevel
  6. */
  7. class M220919093212AddColumn extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="ALTER TABLE qimall_addons_cloud_stock_level add is_open_fill_min tinyint(1) not null default 0 COMMENT '代理进货数量限制:0关闭;1:开启'";
  16. $this->execute($sql);
  17. $sql="ALTER TABLE qimall_addons_cloud_stock_level add fill_min int(10) not null default 0 COMMENT '补货最低数量'";
  18. $this->execute($sql);
  19. $sql="ALTER TABLE qimall_addons_cloud_stock_goods add over_level_list_2 text COMMENT '越2级奖设置';";
  20. $this->execute($sql);
  21. $sql="ALTER TABLE qimall_addons_cloud_stock_agent add fill_num int(10) not null default 0 COMMENT '补货数量'";
  22. $this->execute($sql);
  23. }catch (\Exception $e){
  24. }
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. echo "M220919093212AddFillMinColumnToQimallAddonsCloudStockLevel 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 "M220919093212AddFillMinColumnToQimallAddonsCloudStockLevel cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }