ALTER TABLE `user`
ADD COLUMN `codeno`  varchar(100) NULL AFTER `appTaken`,
ADD COLUMN `orgname`  varchar(100) NULL AFTER `codeno`,
ADD COLUMN `rolename`  varchar(100) NULL AFTER `orgname`,
ADD COLUMN `loginnum`  int(11) NULL DEFAULT 0 AFTER `rolename`,
ADD COLUMN `logindate`  datetime NULL AFTER `loginnum`,
ADD COLUMN `idnumber`  varchar(50) NULL AFTER `logindate`;

ALTER TABLE `user`
ADD COLUMN `orgid`  int(11) NULL AFTER `orgname`;

update `user` set loginnum = 0 where loginnum is NULL;


CREATE TABLE `police_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `native_code` int(11) DEFAULT NULL COMMENT '数据区域',
  `active` bit(1) NOT NULL COMMENT '是否有效',
  `create_time` datetime NOT NULL,
  `update_time` datetime NOT NULL,
  `update_by` varchar(50) NOT NULL,    
  `creater` varchar(100) DEFAULT NULL COMMENT '创建者',
  `createrorg` varchar(50) DEFAULT NULL COMMENT '创建者单位',
  `rolename` varchar(100) DEFAULT NULL COMMENT '角色名称',
  `roledesc` varchar(100) DEFAULT NULL COMMENT '角色说明',
  `oprole` varchar(100) DEFAULT NULL COMMENT '操作权限',
  `datarole` varchar(100) DEFAULT NULL COMMENT '数据范围',
  `orgname` varchar(100) DEFAULT NULL COMMENT '所属机构',
  `orgid` int(11) DEFAULT NULL COMMENT '机构ID',
  `usernum` int(11) DEFAULT '0' COMMENT '人员数',
  PRIMARY KEY (`id`),
  KEY `idx_id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=560 DEFAULT CHARSET=utf8;