MySQL数据表更新模板

-- ----------------------------
-- 新增表
-- ----------------------------
CREATE TABLE `biz_circle_leader_settle`  (
  `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
  `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建日期',
  `leader_id` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '盟主id',
  `money` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '金额',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;


-- ----------------------------
-- 修改表字段类型
-- ----------------------------

alter table `biz_circle_shop` modify column `openid_leader` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'openidLeader';



-- ----------------------------
-- 新增表字段
-- ----------------------------

alter table `biz_circle_user` add `external_userid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部联系人';

alter table `biz_circle_user` add (
  `promote_total_profit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '团品总收益',
  `promote_left_profit` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '团品剩余金额',
  `promote_type` int(1) NULL DEFAULT 0 COMMENT '团品类型',
  `promote_cash_out` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '团品提现金额',
  `promote_pid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '团品父id',
  `phone` varchar(12) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号',
  `name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称',
  `bind_time` datetime(0) NULL DEFAULT NULL COMMENT '绑定时间',
  `promote_left_cash_out` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '团品升级可提现金额'
);

-- ----------------------------
-- 表加索引
-- ----------------------------
ALTER TABLE `rf_user` ADD INDEX `i_openid_leader`(`openid_leader`) USING BTREE;

-- ----------------------------
-- 修改表字段名称
-- ----------------------------

---修改字段名称命令
---ALTER TABLE 表名 CHANGE 旧字段名 新字段名 新数据类型;
ALTER TABLE bank_branch_number CHANGE bankNo branchNo VARCHAR(12);

-- ----------------------------
-- 删除表
-- ----------------------------
DROP TABLE `template_form_id`;


-- ----------------------------
-- 删除表字段
-- ----------------------------
ALTER TABLE `biz_circle_leader_activity` drop column `order_profit`; 


--- 存储过程

posted @ 2021-03-25 15:02  哈喽哈喽111111  阅读(84)  评论(0编辑  收藏  举报