| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace addons\CloudStock\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230717100111QimallAddonsCloudStockFillStatistics
- */
- class M230717100111QimallAddonsCloudStockFillStatistics extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_cloud_stock_fill_statistics';
- $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_fill_statistics` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
- `mall_id` int(11) NOT NULL COMMENT '商城id',
- `user_id` int(11) NOT NULL COMMENT '增加库存代理商用户id',
- `level` int(11) NOT NULL DEFAULT '0' COMMENT '代理等级',
- `self_num` int(11) NOT NULL COMMENT '自身补货数量',
- `direct_num` int(11) NOT NULL COMMENT '直推们的数量,等级一致',
- `indirect_num` int(11) NOT NULL COMMENT '间推们数量,等级一致',
- `start` bigint(20) NOT NULL DEFAULT '0',
- `end` bigint(20) NOT NULL DEFAULT '0',
- `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '奖励金额',
- `award_proportion_settlement_type` tinyint(1) NOT NULL DEFAULT '0',
- `is_upgrade_bag_give_goods` tinyint(1) NOT NULL DEFAULT '0',
- `is_equal_2_step` tinyint(1) NOT NULL DEFAULT '0',
- `award_proportion` text NOT NULL COMMENT 'award_proportion',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` bigint(20) NOT NULL DEFAULT '0',
- `updated_at` bigint(20) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='云库存补货统计表';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230717100111QimallAddonsCloudStockFillStatistics cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230717100111QimallAddonsCloudStockFillStatistics cannot be reverted.\n";
- return false;
- }
- */
- }
|