django 用户管理相关的表
Django 用户管理相关的表:
create table django_content_type ( /* 内容类型表 */ id int(11) not null auto_increment, app_label varchar(100) not null, model varchar(100) not null, primary key (id), unique key uix_django_content_type_app_lable_model (app_label,model) ) -- select * from django_content_type; -- +----+--------------+-------------+ -- | id | app_label | model | -- +----+--------------+-------------+ -- | 1 | admin | logentry | -- | 3 | auth | group | -- | 2 | auth | permission | -- | 4 | auth | user | -- | 5 | contenttypes | contenttype | -- | 6 | sessions | session | -- +----+--------------+-------------+ create table auth_permission ( /* 权限表 */ id int(11) not null auto_increment, name varchar(255) not null, content_type_id int(11) not null, codename varchar(100) not null, primary key (id), unique key uix__auth_permission_content_type_id_codename (content_type_id,codename), constraint uix__auth_permission_content_type_id foreign key (content_type_id) references django_content_type (id) ) create table auth_user ( /* 用户 */ id int(11) not null auto_increment, password varchar(128) not null, last_login datetime(6) DEFAULT NULL, is_superuser tinyint(1) not null, username varchar(150) not null, first_name varchar(30) not null, last_name varchar(150) not null, email varchar(254) not null, is_staff tinyint(1) not null, is_active tinyint(1) not null, date_joined datetime(6) not null, primary key (id), unique key username (username) ) create table auth_group ( /* 用户组 */ id int(11) not null auto_increment, name varchar(80) not null, primary key (id), unique key name (name) ) create table auth_user_groups ( /* 用户 + 组 关联关系表 */ id int(11) not null auto_increment, user_id int(11) not null, group_id int(11) not null, primary key (id), unique key uix__auth_user_groups_user_id_group_id (user_id,group_id), key ix_auth_user_groups_group_id (group_id), constraint fk_auth_user_groups_group_id foreign key (group_id) references auth_group (id), constraint fk_auth_user_groups_user_id foreign key (user_id) references auth_user (id) ) create table auth_user_user_permissions ( /* 用户权限 */ id int(11) not null auto_increment, user_id int(11) not null, permission_id int(11) not null, primary key (id), unique key uix_auth_user_user_permissions_user_id_permission_id (user_id,permission_id), key ix_auth_user_user_permissions_permission_id (permission_id), constraint fk_auth_user_user_permissions_permission_id foreign key (permission_id) references auth_permission (id), constraint fk_auth_user_user_permissions_user_id foreign key (user_id) references auth_user (id) ) create table auth_group_permissions ( /* 组权限 */ id int(11) not null auto_increment, group_id int(11) not null, permission_id int(11) not null, primary key (id), unique key uix_auth_group_permissions (group_id,permission_id), key ix__auth_group_permissions_permission_id (permission_id), constraint fk__auth_group_permissions_auth_permission_id foreign key (permission_id) references auth_permission (id), constraint fk__auth_group_permissions_auth_group_id foreign key (group_id) references auth_group (id) ) create table django_admin_log ( /* 日志表 */ id int(11) not null auto_increment, action_time datetime(6) not null, object_id longtext, object_repr varchar(200) not null, action_flag smallint(5) unsigned not null, change_message longtext not null, content_type_id int(11) DEFAULT NULL, user_id int(11) not null, primary key (id), key ix_django_admin_log_content_type_id (content_type_id), key ix_django_admin_log_user_id (user_id), constraint fk_django_admin_log_content_type_id foreign key (content_type_id) references django_content_type (id), constraint fk_django_admin_log_user_id foreign key (user_id) references auth_user (id) ) create table django_session ( /* 会话表 */ session_key varchar(40) not null, session_data longtext not null, expire_date datetime(6) not null, primary key (session_key), key ix_django_session_expire_date (expire_date) )