
说明：具体的库的名称可以按照实际的进行修改，修改了的话也要同事修改SyncDatabaseCommand文件中的数据库配置

1、创建kailin_migrate_test数据库，把kailin的数据结构和内容传输到kailin_migrate_test
2、创建company_migrate_test 数据库，把company的数据结构和内容传输到company_migrate_test
3、创建system_migrate_test数据库，把system的数据结构和内容传输到system_migrate_test

4、在kailin_migrate_test执行sql：
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `kailin_amount_record` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `pay_time`;
ALTER TABLE `kailin_amount_record` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_banner` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `update_time`;
ALTER TABLE `kailin_banner` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_coupon` ADD COLUMN `company_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '公司id' AFTER `admin_uid`;
ALTER TABLE `kailin_coupon` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_coupon_active` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `active_rule`;
ALTER TABLE `kailin_coupon_active` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_coupon_reward_rule` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '商店ID' AFTER `city_ids`;
ALTER TABLE `kailin_coupon_reward_rule` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `shop_id`;
ALTER TABLE `kailin_custom` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '店铺id' AFTER `company_id`;
ALTER TABLE `kailin_custom_amount` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '商户公司ID' AFTER `transfer_amount`;
ALTER TABLE `kailin_custom_amount` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_custom_clockin_record` COMMENT = '客户打卡';
ALTER TABLE `kailin_custom_clockin_record` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '商户公司ID' AFTER `coupon_id`;
ALTER TABLE `kailin_custom_clockin_record` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_custom_coupon` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '商户公司ID' AFTER `admin_uid`;
ALTER TABLE `kailin_custom_coupon` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_custom_redpacket` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 COMMENT '商户公司ID' AFTER `amount_record_id`;
ALTER TABLE `kailin_custom_redpacket` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_custom_score` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 AFTER `use_score`;
ALTER TABLE `kailin_custom_score` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_lottery_order` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `rule`;
ALTER TABLE `kailin_lottery_order` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_lottery_recruitment` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 0 AFTER `max_reward`;
ALTER TABLE `kailin_lottery_recruitment` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 0 AFTER `company_id`;
ALTER TABLE `kailin_lottery_recruitment_record` ADD COLUMN `reward_type` int(255) unsigned NOT NULL DEFAULT '0' COMMENT '奖品类型' AFTER `reward_id`;
ALTER TABLE `kailin_lottery_riddle` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `max_reward`;
ALTER TABLE `kailin_lottery_riddle` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_lottery_score` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `rule`;
ALTER TABLE `kailin_lottery_score` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_orders` ADD COLUMN `company_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '商户ID' AFTER `custom_uid`;
ALTER TABLE `kailin_orders` ADD COLUMN `shop_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_orders` ADD COLUMN `port_type` tinyint(3) NOT NULL DEFAULT 0 COMMENT '0：小程序；1：H5直播' AFTER `shop_id`;
ALTER TABLE `kailin_orders` ADD COLUMN `producer_id` int(10) NOT NULL COMMENT '生产厂家ID' AFTER `port_type`;

UPDATE `kailin_orders` SET `shop_id` = `business_id`;

ALTER TABLE `kailin_orders_banner` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `city_ids`;
ALTER TABLE `kailin_orders_banner` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_orders_product` ADD COLUMN `company_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '商户ID' AFTER `custom_uid`;
ALTER TABLE `kailin_orders_product` ADD COLUMN `shop_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_orders_product` ADD COLUMN `producer_id` int(10) NOT NULL COMMENT '生产工厂ID' AFTER `shop_id`;
UPDATE `kailin_orders_product` SET `shop_id` = `business_id`;

ALTER TABLE `kailin_orders_receipt` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `admin_uid`;
ALTER TABLE `kailin_orders_receipt` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_producer` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_producer` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_product` ADD COLUMN `shop_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER `producer_id`;
ALTER TABLE `kailin_product` ADD COLUMN `exp_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '有效期至' AFTER `shop_id`;
UPDATE `kailin_product` SET `shop_id` = `business_id`;
ALTER TABLE `kailin_product_spec` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `input_type`;
ALTER TABLE `kailin_product_spec` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_product_type` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_product_type` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_promo` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `admin_uid`;
ALTER TABLE `kailin_promo` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_recruitment_active` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `active_rule`;
ALTER TABLE `kailin_recruitment_active` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_redpacket` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `end_time`;
ALTER TABLE `kailin_redpacket` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_redpacket_active` ADD COLUMN `company_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '商户ID' AFTER `is_arrive`;
ALTER TABLE `kailin_redpacket_active` ADD COLUMN `shop_id` int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT '店铺ID' AFTER `company_id`;
ALTER TABLE `kailin_regiment` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `end_time`;
ALTER TABLE `kailin_regiment` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_regiment_active` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER `company_id`;
UPDATE `kailin_regiment_active` SET `shop_id` = `business_id`;
ALTER TABLE `kailin_riddle_active` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `rule`;
ALTER TABLE `kailin_riddle_active` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_riddle_answer` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `question_id`;
ALTER TABLE `kailin_riddle_answer` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_riddle_question` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_riddle_question` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_score_clockin_active` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_score_clockin_active` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_score_orders` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 COMMENT '公司ID' AFTER `custom_uid`;
ALTER TABLE `kailin_score_orders` ADD COLUMN `shop_id` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER `company_id`;
UPDATE `kailin_score_orders` SET `shop_id` = `business_id`;
ALTER TABLE `kailin_score_product` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `admin_uid`;
ALTER TABLE `kailin_score_product` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_score_record` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 AFTER `custom_uid`;
ALTER TABLE `kailin_score_record` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_share_message` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_share_message` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_share_message` ADD UNIQUE INDEX `fk_kailin_share_message_pages_UNIQUE`(`pages`, `item_id`, `shop_id`) USING BTREE;
ALTER TABLE `kailin_shop_cart` ADD COLUMN `company_id` bigint(20) NOT NULL DEFAULT 1 AFTER `checked`;
ALTER TABLE `kailin_shop_cart` ADD COLUMN `shop_id` bigint(20) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_stock` ADD COLUMN `company_id` int(10) NOT NULL DEFAULT 1 AFTER `status`;
ALTER TABLE `kailin_stock` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
ALTER TABLE `kailin_stock_out` ADD COLUMN `company_id` int(10) NULL DEFAULT 1 AFTER `admin_uid`;
ALTER TABLE `kailin_stock_out` ADD COLUMN `shop_id` int(10) NOT NULL DEFAULT 1 AFTER `company_id`;
SET FOREIGN_KEY_CHECKS=1;

5、在company_migrate_test执行sql：
ALTER TABLE company_migrate_test.kailin_score_orders ADD COLUMN business_id int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER shop_id;
ALTER TABLE company_migrate_test.kailin_score_orders ADD COLUMN remark varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '店铺ID' AFTER track_number;
ALTER TABLE company_migrate_test.kailin_regiment_active ADD COLUMN business_id int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER shop_id;
ALTER TABLE company_migrate_test.kailin_product ADD COLUMN business_id int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER shop_id;
ALTER TABLE company_migrate_test.kailin_orders_product ADD COLUMN business_id int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER shop_id;
ALTER TABLE company_migrate_test.kailin_orders ADD COLUMN business_id int(10) NOT NULL DEFAULT 0 COMMENT '店铺ID' AFTER custom_uid;

6、执行php artisan sync:database