| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace addons\Area\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230613020712AreaV1BiJieShengWu
- */
- class M230613020712AreaV1BiJieShengWu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $this->execute("CREATE TABLE `qimall_addons_area_goods` (
- `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
- `mall_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商城id',
- `user_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '会员id',
- `status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
- `goods_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品ID',
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `user_id` (`user_id`) USING BTREE,
- INDEX `goods_id` (`goods_id`) USING BTREE
- )
- COMMENT='区域代理所代理的指定商品'
- COLLATE='utf8mb4_general_ci'
- ENGINE=InnoDB;");
- $this->execute("CREATE TABLE `qimall_addons_area_commission_log` (
- `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
- `mall_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商城id',
- `user_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '会员id',
- `status` TINYINT(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
- `goods_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '商品ID',
- `order_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '订单ID',
- `order_no` CHAR(26) NOT NULL DEFAULT '' COMMENT '订单编号' COLLATE 'utf8mb4_general_ci',
- `commission_rate` DECIMAL(10,7) UNSIGNED NOT NULL DEFAULT '0.0000000' COMMENT '佣金比例',
- `commission` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0' COMMENT '佣金',
- `commission_status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '佣金状态0未发放,1已发放',
- `area_level` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '代理等级',
- `type` VARCHAR(20) NOT NULL DEFAULT '0' COMMENT '类型' COLLATE 'utf8mb4_general_ci',
- `direction` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '1入,2出',
- `order_detail_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '订单详情ID',
- `is_fixed` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否为固定金额',
- PRIMARY KEY (`id`) USING BTREE,
- INDEX `user_id` (`user_id`) USING BTREE,
- INDEX `goods_id` (`goods_id`) USING BTREE,
- INDEX `created_at` (`created_at`) USING BTREE,
- INDEX `order_detail_id` (`order_detail_id`) USING BTREE
- )
- COMMENT='商品分佣明细'
- COLLATE='utf8mb4_general_ci'
- ENGINE=InnoDB;");
- $this->execute("ALTER TABLE `qimall_addons_area_agent`
- ADD COLUMN `is_enable_dividend` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否参与分红' AFTER `total_score`;");
- $this->execute("ALTER TABLE `qimall_addons_area_apply`
- ADD COLUMN `agent_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '代理ID' AFTER `updated_at`;");
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230613020712AreaV1BiJieShengWu cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230613020712AreaV1BiJieShengWu cannot be reverted.\n";
- return false;
- }
- */
- }
|