MySQL Create Table SQL
Table Structure: okayapi_access:/tablelist/okayapi_access.html
-- MySQL Table okayapi_access
-- From: OkayAPI.com
CREATE TABLE `okayapi_access` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`debug` tinyint(2) NOT NULL DEFAULT '0' COMMENT '是否为调试表,只允许在开发环境使用,测试和线上环境禁用',
`name` varchar(50) NOT NULL COMMENT '实际表名,例如 apijson_user',
`alias` varchar(20) NOT NULL COMMENT '外部调用的表别名,例如 User',
`get` varchar(100) NOT NULL DEFAULT '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' COMMENT '允许 get 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]
用 JSON 类型不能设置默认值,反正权限对应的需求是明确的,也不需要自动转 JSONArray。
TODO: 直接 LOGIN,CONTACT,CIRCLE,OWNER 更简单,反正是开发内部用,不需要复杂查询。',
`head` varchar(100) NOT NULL DEFAULT '["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' COMMENT '允许 head 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`gets` varchar(100) NOT NULL DEFAULT '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' COMMENT '允许 gets 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`heads` varchar(100) NOT NULL DEFAULT '["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"]' COMMENT '允许 heads 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`post` varchar(100) NOT NULL DEFAULT '["OWNER", "ADMIN"]' COMMENT '允许 post 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`put` varchar(100) NOT NULL DEFAULT '["OWNER", "ADMIN"]' COMMENT '允许 put 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`delete` varchar(100) NOT NULL DEFAULT '["OWNER", "ADMIN"]' COMMENT '允许 delete 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"]',
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
KEY `debug` (`debug`),
KEY `name` (`name`),
KEY `alias` (`alias`),
KEY `get` (`get`),
KEY `head` (`head`),
KEY `gets` (`gets`),
KEY `heads` (`heads`),
KEY `post` (`post`),
KEY `put` (`put`),
KEY `delete` (`delete`),
KEY `date` (`date`),
PRIMARY KEY (`id`)
) ENGINE=InnoDB COMMENT 'web开发-权限配置';
After replication, you can go to the database to create the database table.
MySQL database table structure design
Displaying 1-11 of 11 results.
Field Name | Field Type | Default | IS NULL | Field Comment | Index | Demo Data |
---|---|---|---|---|---|---|
debug | tinyint(2) | 0 | 否 | 是否为调试表,只允许在开发环境使用,测试和线上环境禁用 | 0 | |
name | varchar(50) | 否 | 实际表名,例如 apijson_user | Unique Index | ||
alias | varchar(20) | 是 | 外部调用的表别名,例如 User | Unique Index | ||
get | varchar(100) | ["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | 否 | 允许 get 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] 用 JSON 类型不能设置默认值,反正权限对应的需求是明确的,也不需要自动转 JSONArray。 TODO: 直接 LOGIN,CONTACT,CIRCLE,OWNER 更简单,反正是开发内部用,不需要复杂查询。 | ["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | |
head | varchar(100) | ["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | 否 | 允许 head 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["UNKNOWN", "LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | |
gets | varchar(100) | ["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | 否 | 允许 gets 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | |
heads | varchar(100) | ["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | 否 | 允许 heads 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["LOGIN", "CONTACT", "CIRCLE", "OWNER", "ADMIN"] | |
post | varchar(100) | ["OWNER", "ADMIN"] | 否 | 允许 post 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["OWNER", "ADMIN"] | |
put | varchar(100) | ["OWNER", "ADMIN"] | 否 | 允许 put 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["OWNER", "ADMIN"] | |
delete | varchar(100) | ["OWNER", "ADMIN"] | 否 | 允许 delete 的角色列表,例如 ["LOGIN", "CONTACT", "CIRCLE", "OWNER"] | ["OWNER", "ADMIN"] | |
date | timestamp | CURRENT_TIMESTAMP | 否 | 创建时间 | CURRENT_TIMESTAMP |