| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace addons\Agent\console\migrations;
- use common\models\common\Addons;
- use yii\db\Migration;
- /**
- * Class M240222084407QimallAddonsAgentSupplierOrder
- */
- class M240222084407QimallAddonsAgentSupplierOrder extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $table = 'qimall_addons_agent_supplier_order';
- $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_agent_supplier_order` (
- `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) unsigned NOT NULL DEFAULT '0',
- `buy_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '买家id',
- `buy_level` int(11) NOT NULL DEFAULT '0' COMMENT '买家身份',
- `seller_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '卖家id',
- `seller_level` int(11) NOT NULL DEFAULT '0' COMMENT '卖家身份',
- `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '会员订单号',
- `supplier_order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '供应商订单号',
- `goods_nums` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品数量',
- `stock_nums` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '库存加减',
- `payment_amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '货款金额',
- `profit` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '利润',
- `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '订单支付时间',
- `created_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间戳',
- `updated_at` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间戳',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `idx_order_no` (`order_no`),
- KEY `idx_buy_user_id` (`buy_user_id`),
- KEY `idx_seller_user_id` (`seller_user_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='供应商订单';";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240222084407QimallAddonsAgentSupplierOrder cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240222084407QimallAddonsAgentSupplierOrder cannot be reverted.\n";
- return false;
- }
- */
- }
|