update_20170219_1_to_20170214_1.sql 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /*==============================================================*/
  2. /* DBMS name: MySQL 5.0 */
  3. /* Created on: 2017/2/24 12:46:03 */
  4. /*==============================================================*/
  5. drop table if exists tmp_upms_role;
  6. rename table upms_role to tmp_upms_role;
  7. /*==============================================================*/
  8. /* Table: upms_role */
  9. /*==============================================================*/
  10. create table upms_role
  11. (
  12. role_id int(10) unsigned not null auto_increment comment '编号',
  13. name varchar(20) comment '角色名称',
  14. title varchar(20) comment '角色标题',
  15. description varchar(1000) comment '角色描述',
  16. ctime bigint(20) not null comment '创建时间',
  17. orders bigint(20) not null comment '排序',
  18. primary key (role_id)
  19. );
  20. alter table upms_role comment '角色';
  21. insert into upms_role (role_id, name, description, ctime, orders)
  22. select role_id, name, description, ctime, orders
  23. from tmp_upms_role;
  24. alter table upms_role_permission add constraint FK_Reference_23 foreign key (role_id)
  25. references upms_role (role_id) on delete restrict on update restrict;
  26. alter table upms_user_role add constraint FK_Reference_21 foreign key (role_id)
  27. references upms_role (role_id) on delete restrict on update restrict;