diff --git a/sql/relationdb_n_migrate_201014_01.sql b/sql/relationdb_n_migrate_201014_01.sql new file mode 100644 index 0000000..fccfe83 --- /dev/null +++ b/sql/relationdb_n_migrate_201014_01.sql @@ -0,0 +1,68 @@ +begin; + +alter table `user` add column `guild_id` bigint NOT NULL COMMENT '工会id'; +alter table `user` add column `guild_job` int(11) NOT NULL DEFAULT '0' COMMENT '公会职位'; + +CREATE TABLE `guild` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `gameid` int(11) NOT NULL DEFAULT '0' COMMENT 'gameid', + `channel` int(11) NOT NULL DEFAULT '0' COMMENT 'channel', + `guild_id` bigint NOT NULL COMMENT '公会id', + `guild_name` tinyblob COMMENT 'guild_name base64', + `guild_name_base64` varchar(128) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT 'guild_name base64', + `guild_lv` int(11) NOT NULL DEFAULT '0' COMMENT '公会等级', + `guild_exp` double NOT NULL DEFAULT '0' COMMENT '公会经验', + `guild_badge` int(11) NOT NULL DEFAULT '0' COMMENT '公会徽章', + `guild_apply_num` int(11) NOT NULL DEFAULT '0' COMMENT '申请人数', + `guild_members` blob COMMENT '公会管理员', + `guild_member_num` int(11) NOT NULL DEFAULT '0' COMMENT '公会成员数量', + `guild_notice` tinyblob COMMENT '公会公告', + `guild_declaration` tinyblob COMMENT '公会宣言', + `guild_log` mediumblob COMMENT '公会日志', + `owner_id` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '公会主id', + `owner_name` tinyblob COMMENT '公会主名字', + `owner_avatar_url` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '公会主头像', + `creator_id` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '公会创建者id', + `creator_name` tinyblob COMMENT '公会创建者名字', + `creator_avatar_url` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '公会创建者头像', + `guild_data` mediumblob COMMENT '公会数据', + `guild_status` int(11) NOT NULL DEFAULT '0' COMMENT '公会状态 0:新建(未确认) 1:已确认 2:已解散', + `join_unlimited` int(11) NOT NULL DEFAULT '0' COMMENT '不限制加入', + `join_cond1` int(11) NOT NULL DEFAULT '0' COMMENT '加入条件1', + `join_cond2` int(11) NOT NULL DEFAULT '0' COMMENT '加入条件2', + `name_ext1` bigint NOT NULL DEFAULT '0' COMMENT 'name_ext1', + `name_ext2` bigint NOT NULL DEFAULT '0' COMMENT 'name_ext2', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `guild_id` (`guild_id`), + UNIQUE KEY `guild_name` (`gameid`, `name_ext1`, `name_ext2`, `guild_name_base64`), + KEY `owner_id` (`owner_id`), + KEY `creator_id` (`creator_id`), + KEY `modifytime` (`modifytime`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +CREATE TABLE `guild_apply` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `applyid` bigint NOT NULL COMMENT 'applyid', + `guild_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'guild', + `sender_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'sender', + `sender_nickname` tinyblob COMMENT 'nickname', + `sender_avatar_url` varchar(256) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '', + `sender_sex` int(11) NOT NULL DEFAULT '0' COMMENT 'sex', + `sender_data_version1` int(11) NOT NULL DEFAULT '0' COMMENT 'data_version1', + `sender_user_value1` bigint NOT NULL DEFAULT '0' COMMENT 'user_value1', + `sender_user_value2` bigint NOT NULL DEFAULT '0' COMMENT 'user_value2', + `sender_user_value3` bigint NOT NULL DEFAULT '0' COMMENT 'user_value3', + `status` int(11) NOT NULL DEFAULT '0' COMMENT '0:未处理 1:同意 2:拒绝 3:忽略', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `applyid` (`applyid`), + KEY `guild_id` (`guild_id`), + KEY `sender_id` (`sender_id`), + KEY `guild_sender` (`guild_id`, `sender_id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +insert into version (version) values(2020101401); + +commit;