alter table cms_org add f_phone varchar(100) comment '电话'; alter table cms_org add f_fax varchar(100) comment '传真'; alter table cms_org add f_address varchar(255) comment '地址'; alter table cms_org modify f_number varchar(100) comment '编码'; alter table cms_site add f_info_audit_mode int not null default 0 comment '信息审核模式(0:关闭审核,1:单级审核,2:多级审核)'; alter table cms_workflow_step add f_seq int not null default 2147483647 comment '排序'; alter table cms_info modify f_status char(1) not null default 'A' comment '状态(0:发起者,1-9:审核中,A:已终审,B:草稿,C:投稿,D:退稿,E:采集,X:回收站,Z:归档)'; alter table cms_workflow_process add f_site_id int not null comment '站点'; alter table cms_workflow_process add constraint fk_cms_workflowproc_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; alter table cms_workflow_process change f_start_date f_begin_date datetime not null comment '开始时间'; alter table cms_workflow_log add f_site_id int not null comment '站点'; alter table cms_workflow_log add constraint fk_cms_workflowlog_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; alter table cms_workflow_process add f_is_rejection char(1) not null default '0' comment '是否退回'; alter table cms_workflow_process add f_type int not null default 0 comment '类型(0:默认,1:信息)'; alter table cms_user add f_birth_date datetime comment '出生年月'; alter table cms_user add f_gender char(1) comment '性别'; alter table cms_user add f_login_error_date datetime comment '登录错误时间'; alter table cms_user add f_login_error_count int not null default 0 comment '登录错误次数'; alter table cms_user add f_reset_key varchar(100) comment '密码重置KEY'; alter table cms_member drop f_gender; alter table cms_member add f_qq varchar(100) comment 'QQ'; alter table cms_member add f_msn varchar(100) comment 'MSN'; alter table cms_member add f_weixin varchar(100) comment '微信'; alter table cms_info add f_org_id int not null default 1 comment '组织'; alter table cms_user change f_reset_key f_validation_key varchar(100) comment '验证KEY(重置密码,邮箱认证)'; alter table cms_model modify f_type varchar(100) not null comment '类型(info:信息,node:节点,node_home:首页;special:专题)'; update cms_model set f_type='node_home' where f_type='1'; update cms_model set f_type='node' where f_type='2'; update cms_model set f_type='info' where f_type='3'; alter table cms_model_field add f_is_disabled char(1) not null default '0' comment '是否禁用'; create table cms_user_detail ( f_user_id int not null, f_validation_key varchar(100) comment '验证KEY(重置密码,邮箱认证)', f_login_error_date datetime comment '登录错误时间', f_login_error_count int not null default 0 comment '登录错误次数', f_prev_login_date datetime comment '上次登录日期', f_prev_login_ip varchar(100) comment '上次登录IP', f_last_login_date datetime comment '最后登录日期', f_last_login_ip varchar(100) comment '最后登录IP', f_creation_date datetime not null comment '加入日期', f_creation_ip varchar(100) not null comment '加入IP', f_logins int not null default 0 comment '登录次数', f_real_name varchar(100) comment '用户实名', f_avatar varchar(255) comment '头像', f_self_intro varchar(255) comment '自我介绍', f_come_from varchar(100) comment '来自', f_qq varchar(100) comment 'QQ', f_msn varchar(100) comment 'MSN', f_weixin varchar(100) comment '微信', primary key (f_user_id) ) engine = innodb; alter table cms_user_detail comment '用户详细信息表'; alter table cms_user_detail add constraint fk_cms_userdetail_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_admin_role rename to cms_admin_role_temp; create table cms_admin_role ( f_user_id int not null, f_role_id int not null, primary key (f_user_id, f_role_id) ) engine = innodb; alter table cms_admin_role comment '管理员与角色关联表'; insert into cms_admin_role (f_user_id,f_role_id) select f_admin_id,f_role_id from cms_admin_role_temp; drop table cms_admin_role_temp; alter table cms_admin_role add constraint fk_cms_adminrole_role foreign key (f_role_id) references cms_role (f_role_id) on delete restrict on update restrict; alter table cms_admin_role add constraint fk_cms_adminrole_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; insert cms_member_group (f_membergroup_id,f_name) values(1,'普通会员'); insert into t_id_table (f_table,f_id_value) values('cms_member_group',2); insert into cms_user_detail (f_user_id,f_validation_key,f_login_error_date,f_login_error_count,f_prev_login_date,f_prev_login_ip,f_last_login_date,f_last_login_ip,f_creation_date,f_creation_ip,f_logins,f_real_name) select f_user_id,f_validation_key,f_login_error_date,f_login_error_count,f_prev_login_date,f_prev_login_ip,f_last_login_date,f_last_login_ip,f_creation_date,f_creation_ip,f_logins,f_real_name from cms_user; alter table cms_user drop column f_validation_key; alter table cms_user drop column f_login_error_date; alter table cms_user drop column f_login_error_count; alter table cms_user drop column f_prev_login_date; alter table cms_user drop column f_prev_login_ip; alter table cms_user drop column f_last_login_date; alter table cms_user drop column f_last_login_ip; alter table cms_user drop column f_creation_date; alter table cms_user drop column f_creation_ip; alter table cms_user drop column f_logins; alter table cms_user drop column f_real_name; alter table cms_user add f_rank int not null default 2147483647 comment '等级'; alter table cms_user add f_type int not null default 0 comment '类型(0:会员,1:管理员)'; alter table cms_user add f_membergroup_id int not null default 1 comment '会员组'; alter table cms_user add constraint fk_cms_user_membergroup foreign key (f_membergroup_id) references cms_member_group (f_membergroup_id) on delete restrict on update restrict; update cms_user t set t.f_rank=(select t1.f_rank from cms_admin t1 where t1.f_admin_id=t.f_user_id) where t.f_user_id in (select f_admin_id from cms_admin); drop table cms_admin; drop table cms_member; create table cms_friendlink_type ( f_friendlinktype_id int not null, f_site_id int not null, f_name varchar(100) not null comment '名称', f_number varchar(100) comment '编码', f_seq int not null default 2147483647 comment '排序', primary key (f_friendlinktype_id) ) engine = innodb; alter table cms_friendlink_type comment '友情链接类型表'; alter table cms_friendlink_type add constraint fk_cms_friendlinktype_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; create table cms_friendlink ( f_friendlink_id int not null, f_friendlinktype_id int not null, f_site_id int not null, f_name varchar(100) not null comment '网站名称', f_url varchar(255) not null comment '网站地址', f_seq int not null default 2147483647 comment '排序', f_logo varchar(255) comment '网站Logo', f_description varchar(255) comment '网站描述', f_email varchar(100) comment '站长Email', f_is_recommend char(1) not null default '0' comment '是否推荐', f_status char(1) not null default '0' comment '状态(0:已审核,1:未审核)', primary key (f_friendlink_id) ) engine = innodb; alter table cms_friendlink comment '友情链接表'; alter table cms_friendlink add constraint fk_cms_friendlink_friendlinktype foreign key (f_friendlinktype_id) references cms_friendlink_type (f_friendlinktype_id) on delete restrict on update restrict; alter table cms_friendlink add constraint fk_cms_friendlink_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; alter table cms_user_detail change f_self_intro f_bio varchar(255) comment '自我介绍'; update cms_user set f_type=1; alter table cms_user modify f_rank int not null default 999 comment '等级'; alter table cms_admin_role add f_role_index int not null comment '角色序号'; update cms_admin_role set f_role_index=0; alter table cms_admin_role rename to cms_admin_role_temp; create table cms_admin_role ( f_user_id int not null, f_role_id int not null, f_role_index int not null comment '角色序号', primary key (f_user_id, f_role_id, f_role_index) ) engine = innodb; alter table cms_admin_role comment '管理员与角色关联表'; insert into cms_admin_role (f_user_id,f_role_id,f_role_index) select f_user_id,f_role_id,f_role_index from cms_admin_role_temp; drop table cms_admin_role_temp; alter table cms_admin_role add constraint fk_cms_adminrole_role foreign key (f_role_id) references cms_role (f_role_id) on delete restrict on update restrict; alter table cms_admin_role add constraint fk_cms_adminrole_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_site drop column f_info_audit_mode; alter table cms_info_tag rename to cms_info_tag_temp; create table cms_info_tag ( f_infotag_id int not null, f_info_id int not null comment '信息', f_tag_id int not null comment 'tag', f_tag_index int not null default 0 comment 'tag序号', primary key (f_infotag_id) ) engine = innodb; alter table cms_info_tag comment '信息与tag关联表'; insert into cms_info_tag (f_infotag_id,f_info_id,f_tag_id,f_tag_index) select (@row_num:=@row_num+1) as row_num,f_info_id,f_tag_id,f_tag_index from cms_info_tag_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_info_tag',(select (count(*)+1) as f_id_value from cms_info_tag)); drop table cms_info_tag_temp; alter table cms_info_tag add constraint fk_cms_infotag_info foreign key (f_info_id) references cms_info (f_info_id) on delete restrict on update restrict; alter table cms_info_tag add constraint fk_cms_infotag_tag foreign key (f_tag_id) references cms_tag (f_tag_id) on delete restrict on update restrict; alter table cms_info_special rename to cms_info_special_temp; create table cms_info_special ( f_infospecial_id int not null, f_info_id int not null comment '信息', f_special_id int not null comment '专题', f_special_index int not null comment '专题序号', primary key (f_infospecial_id) ) engine = innodb; alter table cms_info_special comment '信息与专题关联表'; insert into cms_info_special (f_infospecial_id,f_info_id,f_special_id,f_special_index) select (@row_num:=@row_num+1) as row_num,f_info_id,f_special_id,f_special_index from cms_info_special_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_info_special',(select (count(*)+1) as f_id_value from cms_info_special)); drop table cms_info_special_temp; alter table cms_info_special add constraint fk_cms_infospecial_info foreign key (f_info_id) references cms_info (f_info_id) on delete restrict on update restrict; alter table cms_info_special add constraint fk_cms_infospecial_special foreign key (f_special_id) references cms_special (f_special_id) on delete restrict on update restrict; alter table cms_friendlink add f_is_with_logo char(1) not null default '0' comment '是否带Logo'; alter table cms_friendlink modify f_status int not null default 0 comment '状态(0:已审核,1:未审核)'; create table cms_guestbook_type ( f_guestbooktype_id int not null, f_site_id int not null comment '站点', f_name varchar(100) not null comment '名称', f_number varchar(100) comment '编码', f_seq int not null default 2147483647 comment '排序', f_description varchar(255) comment '描述', primary key (f_guestbooktype_id) ) engine = innodb; alter table cms_guestbook_type comment '留言板类型表'; alter table cms_guestbook_type add constraint fk_cms_guestbooktype_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; create table cms_guestbook ( f_guestbook_id int not null, f_site_id int not null comment '站点', f_guestbooktype_id int not null comment '留言类型', f_creator_id int not null comment '创建者', f_replyer_id int comment '回复者', f_title varchar(150) comment '留言标题', f_text longtext comment '留言内容', f_creation_date datetime not null comment '留言日期', f_creation_ip varchar(100) not null comment '留言IP', f_reply_text longtext comment '回复内容', f_reply_date datetime comment '回复日期', f_reply_ip varchar(100) comment '回复IP', f_is_reply char(1) not null default '0' comment '是否回复', f_is_recommend char(1) not null default '0' comment '是否推荐', f_status int not null default 0 comment '状态(0:已审核,1:未审核,2:屏蔽)', f_username varchar(100) comment '用户名', f_sex char(1) comment '性别', f_phone varchar(100) comment '电话', f_mobile varchar(100) comment '手机', f_qq varchar(100) comment 'QQ号码', f_email varchar(100) comment '电子邮箱', primary key (f_guestbook_id) ) engine = innodb; alter table cms_guestbook comment '留言板表'; alter table cms_guestbook add constraint fk_cms_guestbook_creator foreign key (f_creator_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_guestbook add constraint fk_cms_guestbook_guestbooktype foreign key (f_guestbooktype_id) references cms_guestbook_type (f_guestbooktype_id) on delete restrict on update restrict; alter table cms_guestbook add constraint fk_cms_guestbook_replyer foreign key (f_replyer_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_guestbook add constraint fk_cms_guestbook_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; drop table cms_user_org; alter table cms_scoregroup modify f_name varchar(100) not null comment '名称'; alter table cms_scoregroup add f_number varchar(100) comment '编码'; alter table cms_scoreboard change f_score f_votes int not null default 0 comment '投票次数'; alter table cms_scoreitem add f_score int not null default 1 comment '分值'; alter table cms_guestbook change f_sex f_gender char(1) comment '性别'; drop table cms_scoreboard_scoreuser; drop table cms_comment_scoreuser; drop table cms_action_mark; create table cms_vote_mark ( f_votemark_id int not null, f_ftype varchar(50) not null comment '外表标识', f_fid int not null comment '外表ID', f_date datetime not null comment '日期', f_mark varchar(100) not null comment '标记(userid,ip或cookie)', f_type int not null default 1 comment '类型(1:用户ID,2:IP,3:Cookie)', primary key (f_votemark_id) ) engine = innodb; alter table cms_vote_mark comment '投票标记表'; create table cms_site_custom ( f_site_id int not null, f_key varchar(50) comment '键', f_value varchar(2000) comment '值' ) engine = innodb; alter table cms_site_custom comment '站点自定义表'; alter table cms_site_custom add constraint fk_cms_sitecustom_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; create table cms_special_custom ( f_special_id int not null, f_key varchar(50) comment '键', f_value varchar(2000) comment '值' ) engine = innodb; alter table cms_special_custom comment '专题自定义表'; alter table cms_special_custom add constraint fk_cms_specialcustom_special foreign key (f_special_id) references cms_special (f_special_id) on delete restrict on update restrict; alter table cms_special add f_user_id int not null default 1 comment '用户'; alter table cms_special add constraint fk_cms_special_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_scoreboard rename cms_score_board; alter table cms_scoreitem rename cms_score_item; alter table cms_scoregroup rename cms_score_group; drop table if exists cms_vote_mark; create table cms_vote_mark ( f_votemark_id int not null, f_ftype varchar(50) not null comment '外表标识', f_fid int not null comment '外表ID', f_date datetime not null comment '日期', f_user_id int comment '用户', f_ip varchar(100) comment 'IP', f_cookie varchar(100) not null comment 'Cookie', primary key (f_votemark_id) ) engine = innodb; alter table cms_vote_mark comment '投票标记表'; create table cms_vote ( f_vote_id int not null, f_site_id int not null, f_title varchar(150) not null comment '标题', f_number varchar(100) comment '编码', f_description varchar(255) comment '描述', f_begin_date datetime comment '开始日期', f_end_date datetime comment '结束日期', f_interval int not null default 0 comment '间隔时间(天)', f_is_multi char(1) not null default '0' comment '是否多选', f_mode int not null default 1 comment '模式(1:独立访客,2:独立IP,3:独立用户)', f_total int not null default 0 comment '总票数', f_seq int not null default 2147483647 comment '排序', f_status int not null default 0 comment '状态(0:启用,1:禁用)', primary key (f_vote_id) ) engine = innodb; alter table cms_vote comment '投票表'; alter table cms_vote add constraint fk_cms_vote_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; create table cms_vote_option ( f_voteoption_id int not null, f_vote_id int not null, f_title varchar(150) not null comment '标题', f_count int not null default 0 comment '得票数', f_seq int not null default 2147483647 comment '排序', primary key (f_voteoption_id) ) engine = innodb; alter table cms_vote_option comment '投票项表'; alter table cms_vote_option add constraint fk_cms_voteoption_vote foreign key (f_vote_id) references cms_vote (f_vote_id) on delete restrict on update restrict; create table cms_sensitive_word ( f_sensitiveword_id int not null, f_name varchar(100) not null comment '敏感词', f_replacement varchar(100) comment '替换词', f_status int not null default 0 comment '状态(0:启用,1:禁用)', primary key (f_sensitiveword_id) ) engine = innodb; alter table cms_sensitive_word comment '敏感词表'; alter table cms_site add f_number varchar(100) comment '编码'; alter table cms_vote change f_is_multi f_max_selected int not null default 1 comment '最多可选几项(0不限制)'; alter table cms_vote_mark modify f_ip varchar(100) not null comment 'IP'; alter table cms_info add f_score int not null default 0 comment '得分'; alter table cms_info_buffer add f_score int not null default 0 comment '得分'; drop table cms_special_custom; alter table cms_special rename to cms_special_temp; create table cms_special ( f_special_id int not null, f_creator_id int not null comment '创建者', f_site_id int not null comment '站点', f_speccate_id int not null comment '专题类别', f_creation_date datetime not null comment '创建日期', f_title varchar(150) not null comment '标题', f_meta_keywords varchar(150) comment '关键字', f_meta_description varchar(255) comment '描述', f_small_image varchar(255) comment '小图', f_large_image varchar(255) comment '大图', f_video varchar(255) comment '视频', f_refers int not null default 0 comment '信息数量', f_views int not null default 0 comment '浏览总数', f_is_with_image char(1) not null default '0' comment '是否有图片', f_is_recommend char(1) not null default '0' comment '是否推荐', primary key (f_special_id) ) engine = innodb; alter table cms_special comment '专题表'; insert into cms_special (f_special_id,f_creator_id,f_site_id,f_speccate_id,f_creation_date,f_title, f_meta_keywords,f_meta_description,f_small_image,f_large_image,f_video, f_refers,f_views,f_is_with_image,f_is_recommend) select f_special_id,f_user_id,f_site_id,f_speccate_id,f_creation_date,f_title, f_meta_keywords,f_meta_description,f_small_image,f_large_image,f_video, f_refers,f_views,f_is_with_image,f_is_recommend from cms_special_temp; alter table cms_info_special rename to cms_info_special_temp; create table cms_info_special ( f_infospecial_id int not null, f_info_id int not null comment '信息', f_special_id int not null comment '专题', f_special_index int not null comment '专题序号', primary key (f_infospecial_id) ) engine = innodb; insert into cms_info_special (f_infospecial_id,f_info_id,f_special_id,f_special_index) select f_infospecial_id,f_info_id,f_special_id,f_special_index from cms_info_special_temp; drop table cms_info_special_temp; alter table cms_info_special comment '信息与专题关联表'; alter table cms_info_special add constraint fk_cms_infospecial_info foreign key (f_info_id) references cms_info (f_info_id) on delete restrict on update restrict; alter table cms_info_special add constraint fk_cms_infospecial_special foreign key (f_special_id) references cms_special (f_special_id) on delete restrict on update restrict; drop table cms_special_temp; alter table cms_special add constraint fk_cms_special_creator foreign key (f_creator_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_special add constraint fk_cms_special_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; alter table cms_special add constraint fk_cms_special_speccate foreign key (f_speccate_id) references cms_special_category (f_speccate_id) on delete restrict on update restrict; create table cms_special_custom ( f_special_id int not null, f_name varchar(50) comment '键', f_value varchar(2000) comment '值' ) engine = innodb; alter table cms_special_custom comment '专题自定义表'; alter table cms_special_custom add constraint fk_cms_specialcustom_special foreign key (f_special_id) references cms_special (f_special_id) on delete restrict on update restrict; alter table cms_info add f_diggs int not null default 0 comment '顶'; alter table cms_info_buffer add f_diggs int not null default 0 comment '顶'; alter table cms_info_buffer add f_burys int not null default 0 comment '踩'; alter table cms_user add f_validation_type varchar(50) comment '验证类型(用户激活,重置密码,邮箱激活)'; alter table cms_user add f_validation_key varchar(100) comment '验证KEY'; alter table cms_user_detail drop f_validation_key; alter table cms_user_detail add f_validation_date datetime comment '验证生成时间'; alter table cms_user_detail add f_validation_value varchar(255) comment '验证值'; alter table cms_global add f_protocol varchar(50) not null default 'http' comment '协议'; alter table cms_info_image modify f_url varchar(255) comment '图片url'; alter table cms_node add f_domain varchar(100) comment '绑定域名'; alter table cms_node add f_domain_path varchar(100) comment '绑定目录'; create table cms_ad_slot ( f_adslot_id int not null, f_site_id int not null, f_name varchar(100) not null comment '名称', f_number varchar(100) comment '编码', f_description varchar(255) comment '描述', f_type int not null comment '类型(1:文字,2:图片,3:FLASH,4:代码)', f_template varchar(255) not null comment '模板', f_width int not null comment '宽度', f_height int not null comment '高度', primary key (f_adslot_id) ) engine = innodb; alter table cms_ad_slot comment '广告版位表'; alter table cms_ad_slot add constraint fk_cms_adslot_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; create table cms_ad ( f_ad_id int not null, f_site_id int not null, f_adslot_id int not null, f_name varchar(150) not null comment '名称', f_begin_date datetime comment '开始时间', f_end_date datetime comment '结束时间', f_url varchar(255) comment '广告url', f_text varchar(255) comment '文字', f_script longtext comment '代码', f_image varchar(255) comment '图片', f_flash varchar(255) comment 'flash', f_seq int not null default 1 comment '排序', primary key (f_ad_id) ) engine = innodb; alter table cms_ad comment '广告表'; alter table cms_ad add constraint fk_cms_ad_adslot foreign key (f_adslot_id) references cms_ad_slot (f_adslot_id) on delete restrict on update restrict; alter table cms_ad add constraint fk_cms_ad_site foreign key (f_site_id) references cms_site (f_site_id) on delete restrict on update restrict; alter table cms_info_detail change f_link_url f_link varchar(255) comment '转向链接'; alter table cms_node_detail change f_link_url f_link varchar(255) comment '转向链接'; update cms_model_field set f_name='link' where f_name='linkUrl' and f_inner_type=2; alter table cms_info_image change f_url f_image varchar(255) comment '图片地址'; alter table cms_info_file change f_url f_file varchar(255) not null comment '文件地址'; alter table cms_info_node rename to cms_info_node_temp; create table cms_info_node ( f_infonode_id int not null, f_info_id int not null comment '信息', f_node_id int not null comment '节点', f_node_index int not null default 0 comment '节点顺序', primary key (f_infonode_id) ) engine = innodb; alter table cms_info_node comment '信息与节点关联表'; insert into cms_info_node (f_infonode_id,f_info_id,f_node_id,f_node_index) select (@row_num:=@row_num+1) as row_num,f_info_id,f_node_id,f_node_index from cms_info_node_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_info_node',(select (count(*)+1) as f_id_value from cms_info_node)); drop table cms_info_node_temp; alter table cms_info_node add constraint fk_cms_infonode_info foreign key (f_info_id) references cms_info (f_info_id) on delete restrict on update restrict; alter table cms_info_node add constraint fk_cms_infonode_node foreign key (f_node_id) references cms_node (f_node_id) on delete restrict on update restrict; create table cms_user_role ( f_userrole_id int not null, f_user_id int not null, f_role_id int not null, f_role_index int not null default 0 comment '角色顺序', primary key (f_userrole_id) ) engine = innodb; alter table cms_user_role comment '用户与角色关联表'; insert into cms_user_role (f_userrole_id,f_user_id,f_role_id,f_role_index) select (@row_num:=@row_num+1) as row_num,f_user_id,f_role_id,f_role_index from cms_admin_role t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_user_role',(select (count(*)+1) as f_id_value from cms_user_role)); drop table cms_admin_role; alter table cms_user_role add constraint fk_cms_userrole_role foreign key (f_role_id) references cms_role (f_role_id) on delete restrict on update restrict; alter table cms_user_role add constraint fk_cms_userrole_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_workflowstep_role rename to cms_workflowstep_role_temp; create table cms_workflowstep_role ( f_wfsteprole_id int not null, f_role_id int not null, f_workflowstep_id int not null, primary key (f_wfsteprole_id) ) engine = innodb; alter table cms_workflowstep_role comment '审核步骤与角色关联表'; insert into cms_workflowstep_role (f_wfsteprole_id,f_role_id,f_workflowstep_id) select (@row_num:=@row_num+1) as row_num,f_role_id,f_workflowstep_id from cms_workflowstep_role_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_workflowstep_role',(select (count(*)+1) as f_id_value from cms_workflowstep_role)); drop table cms_workflowstep_role_temp; alter table cms_workflowstep_role add constraint fk_cms_wfsteprole_role foreign key (f_role_id) references cms_role (f_role_id) on delete restrict on update restrict; alter table cms_workflowstep_role add constraint fk_cms_wfsteprole_wfstep foreign key (f_workflowstep_id) references cms_workflow_step (f_workflowstep_id) on delete restrict on update restrict; alter table cms_workflowproc_user rename to cms_workflowproc_user_temp; create table cms_workflowprocess_user ( f_wfprocuser_id int not null, f_user_id int not null, f_workflowprocess_id int not null, primary key (f_wfprocuser_id) ) engine = innodb; alter table cms_workflowprocess_user comment '工作流过程与用户关联表'; insert into cms_workflowprocess_user (f_wfprocuser_id,f_user_id,f_workflowprocess_id) select (@row_num:=@row_num+1) as row_num,f_user_id,f_workflowprocess_id from cms_workflowproc_user_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_workflowprocess_user',(select (count(*)+1) as f_id_value from cms_workflowprocess_user)); drop table cms_workflowproc_user_temp; alter table cms_workflowprocess_user add constraint fk_cms_wfpuser_user foreign key (f_user_id) references cms_user (f_user_id) on delete restrict on update restrict; alter table cms_workflowprocess_user add constraint fk_cms_wfpuser_wfprocess foreign key (f_workflowprocess_id) references cms_workflow_process (f_workflowprocess_id) on delete restrict on update restrict; alter table cms_rolenode_node rename to cms_rolenode_node_temp; create table cms_rolenode_node ( f_rolennode_id int not null, f_rolesite_id int not null, f_node_id int not null, primary key (f_rolennode_id) ) engine = innodb; alter table cms_rolenode_node comment '角色与节点权限关联表'; insert into cms_rolenode_node (f_rolennode_id,f_rolesite_id,f_node_id) select (@row_num:=@row_num+1) as row_num,f_rolesite_id,f_node_id from cms_rolenode_node_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_rolenode_node',(select (count(*)+1) as f_id_value from cms_rolenode_node)); drop table cms_rolenode_node_temp; alter table cms_rolenode_node add constraint fk_cms_rolennode_node foreign key (f_node_id) references cms_node (f_node_id) on delete restrict on update restrict; alter table cms_rolenode_node add constraint fk_cms_rolennode_role foreign key (f_rolesite_id) references cms_role_site (f_rolesite_id) on delete restrict on update restrict; alter table cms_rolenode_info rename to cms_rolenode_info_temp; create table cms_rolenode_info ( f_roleninfo_id int not null, f_rolesite_id int not null, f_node_id int not null, primary key (f_roleninfo_id) ) engine = innodb; alter table cms_rolenode_info comment '角色与信息权限关联表'; insert into cms_rolenode_info (f_roleninfo_id,f_rolesite_id,f_node_id) select (@row_num:=@row_num+1) as row_num,f_rolesite_id,f_node_id from cms_rolenode_info_temp t,(select (@row_num :=0)) rn; insert into t_id_table (f_table,f_id_value) values('cms_rolenode_info',(select (count(*)+1) as f_id_value from cms_rolenode_info)); drop table cms_rolenode_info_temp; alter table cms_rolenode_info add constraint fk_cms_roleninfo_node foreign key (f_node_id) references cms_node (f_node_id) on delete restrict on update restrict; alter table cms_rolenode_info add constraint fk_cms_roleninfo_role foreign key (f_rolesite_id) references cms_role_site (f_rolesite_id) on delete restrict on update restrict; drop table cms_memgroupnode_view; create table cms_memgroupnode_view ( f_mgroupnview_id int not null, f_memgroupsite_id int not null, f_node_id int not null, primary key (f_mgroupnview_id) ) engine = innodb; alter table cms_memgroupnode_view comment '会员组与节点浏览权限关联表'; alter table cms_memgroupnode_view add constraint fk_cms_mgroupnview_memgroup foreign key (f_memgroupsite_id) references cms_membergroup_site (f_memgroupsite_id) on delete restrict on update restrict; alter table cms_memgroupnode_view add constraint fk_cms_mgroupnview_node foreign key (f_node_id) references cms_node (f_node_id) on delete restrict on update restrict; drop table cms_memgroupnode_contri; create table cms_memgroupnode_contri ( f_mgroupncontri_id int not null, f_memgroupsite_id int not null, f_node_id int not null, primary key (f_mgroupncontri_id) ) engine = innodb; alter table cms_memgroupnode_contri comment '会员组与投稿权限关联表'; alter table cms_memgroupnode_contri add constraint fk_cms_mgroupncontri_memgroup foreign key (f_memgroupsite_id) references cms_membergroup_site (f_memgroupsite_id) on delete restrict on update restrict; alter table cms_memgroupnode_contri add constraint fk_cms_mgroupncontri_node foreign key (f_node_id) references cms_node (f_node_id) on delete restrict on update restrict;