| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace addons\Distribution\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230406095550QimallAddonsDistributionUpgradeLimit
- */
- class M230406095550QimallAddonsDistributionUpgradeLimit extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_distribution_upgrade_limit';
- $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_distribution_upgrade_limit` (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) DEFAULT '0' COMMENT '商城ID',
- `user_id` int(10) DEFAULT '0' COMMENT '消费者ID',
- `serve_uid` int(4) DEFAULT '0' COMMENT '消费者上级ID',
- `level` tinyint(4) DEFAULT '0' COMMENT '消费者上级等级',
- `achievement` decimal(12,2) DEFAULT '0.00' COMMENT '为上级贡献的业绩,单位:元',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(10) DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(10) DEFAULT '0' COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `user_id+serve_uid` (`user_id`,`serve_uid`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='分销商商团队业绩升级限制表';
- ";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230406095550QimallAddonsDistributionUpgradeLimit cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230406095550QimallAddonsDistributionUpgradeLimit cannot be reverted.\n";
- return false;
- }
- */
- }
|