M220906031833QimallAddonsStoreCouponRemind.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220906031833QimallAddonsStoreCouponRemind
  6. */
  7. class M220906031833QimallAddonsStoreCouponRemind extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_coupon_remind';
  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. 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
  22. 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'),
  23. 'user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('会员id'),
  24. 'expire_time' => $this->integer(11)->notNull()->defaultValue(0)->comment('过期时间'),
  25. 'send_status' => $this->tinyInteger(1)->notNull()->defaultValue(2)->comment('提醒状态,1:未发送提醒,2:已发送提醒,3:不需要发送提醒,已使用或者已转赠或者优惠券已过期或者优惠券已经失效'),
  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 "M220906031833QimallAddonsStoreCouponRemind 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 "M220906031833QimallAddonsStoreCouponRemind cannot be reverted.\n";
  48. return false;
  49. }
  50. */
  51. }