| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace addons\Agent\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230519082911CreateTableAgentCommissionDetails
- */
- class M230519082911CreateTableAgentCommissionDetails extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $createSql = "CREATE TABLE `qimall_agent_commission_details` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
- `mall_id` int(11) NOT NULL COMMENT '商城ID',
- `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '经销商用户ID',
- `agent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '经销商ID',
- `order_id` int(11) NOT NULL COMMENT '订单ID',
- `level` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '经销商等级',
- `order_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单金额',
- `commission` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '佣金金额',
- `reward_type` varchar(32) NOT NULL DEFAULT '' COMMENT '奖励类型',
- `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) NOT NULL COMMENT '更新时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;";
- $this->execute($createSql);
- $alterSql = "ALTER TABLE `qimall_addons_agent`
- ADD COLUMN `province_id` int(11) NOT NULL DEFAULT 0 COMMENT '省份ID';";
- $this->execute($alterSql);
- $alterSql = "ALTER TABLE `qimall_addons_agent_commission_item_setting`
- ADD COLUMN `is_percent_recommend` tinyint(1) NOT NULL DEFAULT 0 COMMENT '推荐奖类型 0百分比 1 固定金额',
- ADD COLUMN `is_enable_recommend` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否启用推荐奖: 0: 否,1:是';";
- $this->execute($alterSql);
- $alterSql = "ALTER TABLE `qimall_addons_agent_commission_item_setting_detail`
- ADD COLUMN `agent_recommend_prize` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '推荐奖'";
- $this->execute($alterSql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230519082911CreateTableAgentCommissionDetails cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230519082911CreateTableAgentCommissionDetails cannot be reverted.\n";
- return false;
- }
- */
- }
|