db->createCommand($sql)->execute(); if(!empty($res)) return ''; $this->createTable($table, [ 'id' => $this->primaryKey(), 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城id'), 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'), 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'), 'user_coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('赠送者coupon_user_relate表的id'), 'get_user_coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('领取者coupon_user_relate表的id'), 'giving_user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('转出会员id,值为 0 说明是平台赠送的优惠券'), 'receive_user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('受赠会员id,尚未被领取此字段值为0'), 'giving_status' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('转赠状态,1:转赠中(已分享出去,未被领取),2:已被领取'), 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('添加时间'), 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('修改时间'), ]); $this->addCommentOnTable($table,'优惠券分享记录表'); } /** * {@inheritdoc} */ public function safeDown() { echo "M220906032843QimallAddonsStoreCouponShareLog cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M220906032843QimallAddonsStoreCouponShareLog cannot be reverted.\n"; return false; } */ }