| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace addons\Distribution\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230406095623QimallAddonsDistributionUpgradeCount
- */
- class M230406095623QimallAddonsDistributionUpgradeCount extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_distribution_upgrade_count';
- $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_count` (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) DEFAULT '0' COMMENT '商城ID',
- `user_id` int(10) DEFAULT '0' COMMENT '服务商ID',
- `direct_num` int(10) 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` (`user_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='分销商团队业绩统计表';
- ";
- $this->execute($sql);
- } catch (\Exception $e) {
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230406095623QimallAddonsDistributionUpgradeCount cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230406095623QimallAddonsDistributionUpgradeCount cannot be reverted.\n";
- return false;
- }
- */
- }
|