You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.6 KiB
35 lines
1.6 KiB
|
3 years ago
|
use `lx-im`;
|
||
|
|
create table `user`(
|
||
|
|
`id` bigint not null auto_increment primary key comment 'id',
|
||
|
|
`user_name` varchar(255) not null comment '用户名',
|
||
|
|
`nick_name` varchar(255) not null comment '用户昵称',
|
||
|
|
`head_image` varchar(255) default '' comment '用户头像',
|
||
|
|
`password` varchar(255) not null comment '密码(明文)',
|
||
|
|
`last_login_time` datetime DEFAULT null comment '最后登录时间',
|
||
|
|
`created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
|
||
|
|
unique key `idx_user_name`(user_name),
|
||
|
|
key `idx_nick_name`(nick_name)
|
||
|
|
);
|
||
|
|
|
||
|
|
create table `friends`(
|
||
|
|
`id` bigint not null auto_increment primary key comment 'id',
|
||
|
|
`user_id` bigint not null comment '用户id',
|
||
|
|
`friend_id` bigint not null comment '好友id',
|
||
|
|
`friend_nick_name` varchar(255) not null comment '用户昵称',
|
||
|
|
`friend_head_image` varchar(255) default '' comment '用户头像',
|
||
|
|
`created_time` datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
|
||
|
|
key `idx_user_id` (`user_id`),
|
||
|
|
key `idx_friend_id` (`friend_id`)
|
||
|
|
);
|
||
|
|
|
||
|
|
|
||
|
|
create table `single_message`(
|
||
|
|
`id` bigint not null auto_increment primary key comment 'id',
|
||
|
|
`send_user_id` bigint not null comment '发送用户id',
|
||
|
|
`recv_user_id` bigint not null comment '接收用户id',
|
||
|
|
`content` text comment '发送内容',
|
||
|
|
`type` tinyint(1) NOT NULL comment '消息类型 0:文字 1:图片 2:文件',
|
||
|
|
`status` tinyint(1) NOT NULL comment '状态 0:未读 1:已读 ',
|
||
|
|
`send_time` datetime DEFAULT CURRENT_TIMESTAMP comment '发送时间',
|
||
|
|
key `idx_send_recv_user_id` (`send_user_id`,`recv_user_id`)
|
||
|
|
);
|