init.sql 2.1 KB

123456789101112131415161718192021222324252627282930313233
  1. create database if not exists `open-api-platform`;
  2. USE `open-api-platform`;
  3. -- 创建一个名为users的表,用于存储用户信息
  4. CREATE TABLE if NOT EXISTS `user` (
  5. `id` BIGINT NOT NULL PRIMARY KEY COMMENT '用户ID',
  6. `user_account` VARCHAR(255) NOT NULL COMMENT '用户账号',
  7. `user_password` VARCHAR(255) NOT NULL COMMENT '用户密码',
  8. `user_name` VARCHAR(255) NOT NULL COMMENT '用户名称',
  9. `user_avatar` VARCHAR(1024) DEFAULT NULL COMMENT '用户头像',
  10. `user_role` CHAR(32) NOT NULL DEFAULT '用户' COMMENT '用户角色',
  11. `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  12. `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  13. `delete_flag` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '删除标志,0:未删除,1:已删除'
  14. ) COMMENT='用户表';
  15. -- 接口信息
  16. create table if not exists `interface_info`
  17. (
  18. `id` bigint not null auto_increment comment '主键' primary key,
  19. `name` varchar(256) not null comment '名称',
  20. `description` varchar(256) null comment '描述',
  21. `url` varchar(512) not null comment '接口地址',
  22. `request_header` text null comment '请求头',
  23. `response_header` text null comment '响应头',
  24. `status` int default 0 not null comment '接口状态(0-关闭,1-开启)',
  25. `method` varchar(256) not null comment '请求类型',
  26. `user_id` bigint not null comment '创建人',
  27. `create_time` datetime default CURRENT_TIMESTAMP not null comment '创建时间',
  28. `update_time` datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '更新时间',
  29. `delete_flag` tinyint default 0 not null comment '是否删除(0-未删, 1-已删)'
  30. ) comment '接口信息';