| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M220906034739QimallAddonsStoreCouponUseLog
- */
- class M220906034739QimallAddonsStoreCouponUseLog extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_store_coupon_use_log';
- $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('mall_id'),
- 'user_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('user_id'),
- 'order_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('order_id'),
- 'coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('优惠券id'),
- 'user_coupon_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('user_coupon_id'),
- '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 "M220906034739QimallAddonsStoreCouponUseLog cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220906034739QimallAddonsStoreCouponUseLog cannot be reverted.\n";
- return false;
- }
- */
- }
|