| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <?php
- namespace addons\CloudStock\console\migrations;
- use yii\db\Migration;
- /**
- * Class M241101071836Huolihuoban1
- */
- class M241101071836Huolihuoban1 extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "alter table qimall_addons_cloud_stock_goods add sort decimal(12,2) not null default 0 comment '排序值,小排前';
- alter table qimall_addons_cloud_stock_goods add min_replenish int(11) not null default 0 comment '最低进货数量';
- alter table qimall_addons_cloud_stock_goods add restrict_permissions varchar(255) not null default '' comment '限制权限';
- alter table qimall_addons_cloud_stock_agent add cloud_warehouse_frozen_price decimal(12,2) not null default 0 comment '云仓待结货款';
- alter table qimall_addons_cloud_stock_agent add cloud_warehouse_price decimal(12,2) not null default 0 comment '云仓已结货款';
- alter table qimall_addons_cloud_stock_agent add cloud_warehouse_withdraw_price decimal(12,2) not null default 0 comment '云仓已提现货款';
- INSERT INTO `qimall_global_var_map` ( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ( 'cloud_stock_payment_transfer', '货款转余额', 'CapitalTypeMap', 0, 1, 1654569888, 1654569888);
- ALTER table qimall_addons_cloud_stock_delay_log add type tinyint(3) not null default 0 comment '0:云库存默认的(货款佣金,奖励之类);1:云仓货款';
- ";
- $this->execute($sql);
- $table = 'qimall_addons_cloud_stock_gift_plan';
- $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if (empty($res)) {
- $sql = "CREATE TABLE `qimall_addons_cloud_stock_gift_plan` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL COMMENT '商城id',
- `goods_id` text,
- `give_goods_num` text,
- `give_goods_id` text,
- `gift_condition_level` varchar(255) NOT NULL DEFAULT '',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='赠送方案';";
- $this->execute($sql);
- }
- $table = 'qimall_addons_cloud_stock_payment_log';
- $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if (empty($res)) {
- $sql = "CREATE TABLE `qimall_addons_cloud_stock_payment_log` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) unsigned NOT NULL,
- `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'store_id',
- `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '会员id',
- `buy_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源会员id',
- `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
- `goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
- `pic_url` varchar(255) NOT NULL DEFAULT '' COMMENT '商品主图',
- `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
- `order_detail_id` int(11) unsigned NOT NULL COMMENT '订单详情id',
- `num` int(11) unsigned NOT NULL COMMENT '商品件数',
- `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '订单编号',
- `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
- `type` varchar(50) NOT NULL DEFAULT '' COMMENT '货款类型:fill:补货货款;buying:会员买货',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:待结算;1已结算]',
- `created_at` int(10) unsigned NOT NULL DEFAULT '0',
- `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `idx_user_id` (`user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云仓货款记录表';";
- $this->execute($sql);
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M241101071836Huolihuoban1 cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M241101071836Huolihuoban1 cannot be reverted.\n";
- return false;
- }
- */
- }
|