| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace addons\CloudStock\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230717100142QimallAddonsCloudStockBonusPoolUser
- */
- class M230717100142QimallAddonsCloudStockBonusPoolUser extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_cloud_stock_bonus_pool_user';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `qimall_addons_cloud_stock_bonus_pool_user` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户ID',
- `level` int(10) NOT NULL DEFAULT '0' COMMENT '等级(权重)',
- `pool_income` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '分红池总收益,单位:元',
- `upgrade_status` smallint(6) NOT NULL DEFAULT '0' COMMENT '1条件升级,2购买指定商品升级,3手动升级',
- `upgrade_level_at` int(10) NOT NULL DEFAULT '0' COMMENT '等级升级时间',
- `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` bigint(20) DEFAULT '0' COMMENT '创建时间',
- `updated_at` bigint(20) DEFAULT '0' COMMENT '更新时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_user_id_level` (`mall_id`,`user_id`,`level`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='云库存分红池用户';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230717100142QimallAddonsCloudStockBonusPoolUser cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230717100142QimallAddonsCloudStockBonusPoolUser cannot be reverted.\n";
- return false;
- }
- */
- }
|