repair_lite.sql 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*==============================================================*/
  2. /* DBMS name: MySQL 5.0 */
  3. /* Created on: 2019/3/5 22:17:43 */
  4. /*==============================================================*/
  5. drop table if exists action_bar;
  6. drop table if exists action_permission;
  7. drop table if exists user_permission;
  8. drop table if exists user;
  9. /*==============================================================*/
  10. /* Table: action_bar */
  11. /*==============================================================*/
  12. create table action_bar
  13. (
  14. id int not null auto_increment,
  15. parent int default 0 comment '该层菜单的上级菜单',
  16. level int default 1 comment '该级菜单是第几级菜单',
  17. link_type char(32) comment '定义link的含义,可以是跳转,可以是发起请求',
  18. link char(255),
  19. status char(32) comment '状态表,可能用户编辑了这个菜单,但是没有编辑完,所以只是存了一份草稿',
  20. create_time timestamp default CURRENT_TIMESTAMP,
  21. modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  22. is_del bool default false,
  23. primary key (id)
  24. );
  25. alter table action_bar comment '下拉菜单';
  26. /*==============================================================*/
  27. /* Table: action_permission */
  28. /*==============================================================*/
  29. create table action_permission
  30. (
  31. id int not null comment '用户id',
  32. bars varchar(128) comment '用户有权限的下拉列表,多个如1,2,3,4用逗号隔开',
  33. create_time timestamp default CURRENT_TIMESTAMP comment '创建时间',
  34. modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
  35. status char(32) comment '角色是否生效的状态',
  36. is_del bool default false comment '删除标志',
  37. primary key (id)
  38. );
  39. alter table action_permission comment '下拉菜单权限表';
  40. /*==============================================================*/
  41. /* Table: user */
  42. /*==============================================================*/
  43. create table user
  44. (
  45. id int not null,
  46. username varchar(128) not null comment '用户名',
  47. password varchar(128) not null comment '用户密码',
  48. nickname varchar(255) comment '用户昵称',
  49. tel char(16) comment '用户电话',
  50. email char(64) comment '用户邮箱',
  51. create_time timestamp default CURRENT_TIMESTAMP comment '创建时间',
  52. modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
  53. is_del bool default false comment '删除标志',
  54. primary key (id)
  55. );
  56. alter table user comment '用户表';
  57. /*==============================================================*/
  58. /* Table: user_permission */
  59. /*==============================================================*/
  60. create table user_permission
  61. (
  62. id int not null comment '用户id',
  63. role int comment '用户权限,为管理员或者普通用户,取值为1,2,4,8,16...',
  64. create_time timestamp default CURRENT_TIMESTAMP,
  65. modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  66. status char(32),
  67. is_del bool default false,
  68. primary key (id)
  69. );
  70. alter table user_permission comment '用户权限表';
  71. alter table action_permission add constraint FK_bar_permission foreign key (id)
  72. references user (id) on delete restrict on update restrict;
  73. alter table user_permission add constraint FK_user_permission foreign key (id)
  74. references user (id) on delete restrict on update restrict;