M230831033921AlterQimallAddonsStoreSettings.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230831033921AlterQimallAddonsStoreSettings
  6. */
  7. class M230831033921AlterQimallAddonsStoreSettings extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "ALTER TABLE `qimall_addons_store_settings`
  15. ADD COLUMN `enable_discount_price` tinyint(1) NOT NULL DEFAULT 0 COMMENT '启用折扣价格 1:启用;0禁用',
  16. ADD COLUMN `discount_price_scale` decimal(6, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣比例设置';";
  17. $this->execute($sql);
  18. $sql = "ALTER TABLE `qimall_addons_store_commission`
  19. ADD COLUMN `store_contributing_money` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '折扣金额';";
  20. $this->execute($sql);
  21. $sql = "INSERT INTO `qimall_global_var_map`(`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('store_consumption_rewards', '消费奖励', 'CapitalTypeMap', 1, 1, 1654569888, 1654569888);";
  22. $this->execute($sql);
  23. }
  24. /**
  25. * {@inheritdoc}
  26. */
  27. public function safeDown()
  28. {
  29. echo "M230831033921AlterQimallAddonsStoreSettings 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 "M230831033921AlterQimallAddonsStoreSettings cannot be reverted.\n";
  40. return false;
  41. }
  42. */
  43. }