M220906030636QimallAddonsStoreCouponGiveItemSetting.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220906030636QimallAddonsStoreCouponGiveItemSetting
  6. */
  7. class M220906030636QimallAddonsStoreCouponGiveItemSetting extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_coupon_give_item_setting';
  15. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  16. $res = $this->db->createCommand($sql)->execute();
  17. if(!empty($res)) return '';
  18. $this->createTable($table, [
  19. 'id' => $this->primaryKey(),
  20. 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城ID'),
  21. 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店'),
  22. 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
  23. 'is_enable' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否独立设置:0:否;1是'),
  24. 'item_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('项目id'),
  25. 'item_type' => $this->string(255)->notNull()->defaultValue('')->comment('项目类型:商品goods'),
  26. 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态[-1:删除;0:禁用;1启用]'),
  27. 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('添加时间'),
  28. 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('修改时间'),
  29. ]);
  30. $this->addCommentOnTable($table,'优惠券项目赠送设置');
  31. }
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function safeDown()
  36. {
  37. echo "M220906030636QimallAddonsStoreCouponGiveItemSetting cannot be reverted.\n";
  38. return false;
  39. }
  40. /*
  41. // Use up()/down() to run migration code without a transaction.
  42. public function up()
  43. {
  44. }
  45. public function down()
  46. {
  47. echo "M220906030636QimallAddonsStoreCouponGiveItemSetting cannot be reverted.\n";
  48. return false;
  49. }
  50. */
  51. }