| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M230922021030OrderInvoice
- */
- class M230922021030OrderInvoice extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "ALTER TABLE `qimall_order` ADD COLUMN `is_bill` tinyint(1) NULL DEFAULT 0 COMMENT '是否已开票 0 否 1 是', ADD COLUMN `bill_time` int(11) NULL DEFAULT 0 COMMENT '开票时间';";
- $this->execute($sql);
- $sql = "INSERT INTO `qimall_menu` (`title`, `app_id`, `cate_id`, `addons_name`, `is_addon`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('开票记录', 'backend', '2', '', '0', '33', 'mall/order/invoice', '', '2', '1', '999', NULL, ' tr_33', '1', '1695117641', '1695117641');";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_order_invoice` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单ID',
- `order_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单编号',
- `pay_money` decimal(10,2) DEFAULT NULL COMMENT '订单实付金额',
- `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发票类型',
- `head_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '抬头类型',
- `head_name` varchar(100) NOT NULL DEFAULT '' COMMENT '发票抬头',
- `bank_name` varchar(100) NOT NULL DEFAULT '' COMMENT '开户银行',
- `account` varchar(100) NOT NULL DEFAULT '' COMMENT '开户账户',
- `email` varchar(100) NOT NULL DEFAULT '' COMMENT '邮箱号',
- `address` varchar(255) NOT NULL DEFAULT '' COMMENT '地址',
- `mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '电话',
- `tax_no` varchar(100) NOT NULL DEFAULT '' COMMENT '税号',
- `invoice_status` int(6) DEFAULT '0' COMMENT '开票状态 0 申请中 1 已同意 2 已拒绝',
- `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
- `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(10) NOT NULL DEFAULT '0',
- `updated_at` int(10) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `order_id` (`order_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230922021030OrderInvoice cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230922021030OrderInvoice cannot be reverted.\n";
- return false;
- }
- */
- }
|