| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M220906030636QimallAddonsStoreCouponGiveItemSetting
- */
- class M220906030636QimallAddonsStoreCouponGiveItemSetting extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_store_coupon_give_item_setting';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $this->createTable($table, [
- 'id' => $this->primaryKey(),
- 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城ID'),
- 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店'),
- 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
- 'is_enable' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否独立设置:0:否;1是'),
- 'item_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('项目id'),
- 'item_type' => $this->string(255)->notNull()->defaultValue('')->comment('项目类型:商品goods'),
- 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态[-1:删除;0:禁用;1启用]'),
- '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 "M220906030636QimallAddonsStoreCouponGiveItemSetting cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220906030636QimallAddonsStoreCouponGiveItemSetting cannot be reverted.\n";
- return false;
- }
- */
- }
|