db->createCommand($sql)->execute(); if(empty($res)){ $sql=" CREATE TABLE `qimall_addons_reservation_service_store_goods` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID', `store_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id', `goods_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '绑定的商品ID', `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', `mall_id` int(10) unsigned NOT NULL COMMENT '商城ID', `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态0禁用,-1删除,1正常', PRIMARY KEY (`id`) USING BTREE, KEY `user_id` (`user_id`) USING BTREE, KEY `store_id` (`store_id`) USING BTREE, KEY `goods_id` (`goods_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='技师绑定的o2o门店项目';"; $this->execute($sql); } $table = 'qimall_addons_reservation_service_occupy'; $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';"; $res = $this->db->createCommand($sql)->execute(); if (empty($res)) { $sql = " CREATE TABLE `qimall_addons_reservation_service_occupy` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID', `mall_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID', `store_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店ID', `staff_user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '技师用户ID', `start_at` int(11) NOT NULL DEFAULT '0' COMMENT '服务开始时间', `end_at` int(11) NOT NULL DEFAULT '0' COMMENT '服务结束时间', `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态0禁用,-1删除,1正常', `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间', `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间', PRIMARY KEY (`id`) USING BTREE, KEY `staff_user_id` (`staff_user_id`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='技师占用记录'; "; $this->execute($sql); } } /** * {@inheritdoc} */ public function safeDown() { echo "M240926103303QimallAddonsReservationServiceStoreGoods cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M240926103303QimallAddonsReservationServiceStoreGoods cannot be reverted.\n"; return false; } */ }