cashier_server/sqls/250403/tb_shop_info.sql

65 lines
3.9 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ALTER TABLE `tb_shop_info`
ADD COLUMN `is_head_shop` tinyint NULL COMMENT '是否主店 1-是 0-否';
-- ----------------------------
-- 更新历史数据将创建时间在2025年4月3日之前的店铺设置为非主店
-- ----------------------------
update tb_shop_info
set is_head_shop = 0
where create_time < str_to_date('2025-04-03 00:00:00', '%Y-%m-%d %H:%i:%s');
-- ----------------------------
-- 创建店铺配置扩展表
-- ----------------------------
CREATE TABLE `tb_shop_config`
(
`id` bigint NOT NULL COMMENT '店铺id',
`main_id` bigint NULL DEFAULT NULL COMMENT '主店id',
`is_enable_prod_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用商品同步 1-是 0-否',
`is_enable_vip_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用会员同步 1-是 0-否',
`is_enable_cons_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用耗材同步 1-是 0-否',
`is_allow_account_login` tinyint NOT NULL DEFAULT 1 COMMENT '是否允许账号登录 1-是 0-否',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`is_custom_amount` int NOT NULL DEFAULT 0 COMMENT '是否允许会员自定义金额 1-允许 0-不允许',
`is_return_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启退款密码 1-启用 0-禁用',
`is_member_in_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启会员充值密码 1-启用 0-禁用',
`is_member_return_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启会员退款密码 1-启用 0-禁用',
`is_table_fee` int NOT NULL DEFAULT 1 COMMENT '是否免除桌位费 1-是 0-否',
`is_member_price` int NOT NULL DEFAULT 0 COMMENT '是否启用会员价 1-是 0-否 ',
`is_account_pay` tinyint NOT NULL DEFAULT 0 COMMENT '是否允许会员余额支付 1-是 0-否',
`branch_data_sync_method` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分店数据同步方式 auto-自动同步 manual-手动同步',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_0900_ai_ci COMMENT = '店铺配置扩展'
ROW_FORMAT = Dynamic;
-- ----------------------------
-- 转移历史数据至【店铺配置扩展表】
-- ----------------------------
insert into tb_shop_config
select id,
main_id,
0 as is_enable_prod_sync,
0 as is_enable_vip_sync,
0 as is_enable_cons_sync,
1 as is_allow_account_login,
null as remark,
is_custom_amount,
is_return_pwd,
is_member_in_pwd,
is_member_return_pwd,
is_table_fee,
is_member_price,
is_account_pay,
null as branch_data_sync_method
from tb_shop_info;
-- ----------------------------
-- 删除店铺主表是否xxx等字段迁移至店铺配置扩展表
-- ----------------------------
ALTER TABLE `tb_shop_info`
DROP COLUMN `is_custom_amount`,
DROP COLUMN `is_return_pwd`,
DROP COLUMN `is_member_in_pwd`,
DROP COLUMN `is_member_return_pwd`,
DROP COLUMN `is_table_fee`,
DROP COLUMN `is_member_price`,
DROP COLUMN `is_account_pay`;