2022-09-30 08:06:14 +08:00
|
|
|
|
CREATE DATABASE `neteaseMusic` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
|
|
|
|
|
USE `neteaseMusic`;
|
|
|
|
|
CREATE TABLE `song` (
|
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
2022-10-17 22:28:33 +08:00
|
|
|
|
`title` varchar(500)NOT NULL COMMENT '歌曲名',
|
2022-10-17 21:29:23 +08:00
|
|
|
|
`type` tinyint(4) NOT NULL COMMENT ' 0: 一般类型 1: 通过云盘上传的音乐,网易云不存在公开对应 2: 通过云盘上传的音乐,网易云存在公开对应',
|
|
|
|
|
`alias` json DEFAULT NULL COMMENT '歌曲别名(JSON格式数组)',
|
|
|
|
|
`pop` float DEFAULT NULL COMMENT '歌曲热度',
|
|
|
|
|
`fee` tinyint(4) DEFAULT NULL COMMENT '版权 0: 免费或无版权 1: VIP 歌曲 4: 购买专辑 8: 非会员可免费播放低音质,会员可播放高音质及下载 fee 为 1 或 8 的歌曲均可单独购买 2 元单曲',
|
|
|
|
|
`quality` varchar(500)NOT NULL COMMENT '高/中/低/无损质量文件信息',
|
|
|
|
|
`cd` varchar(255) NOT NULL COMMENT 'None或如"04", "1/2", "3", "null"的字符串,表示歌曲属于专辑中第几张CD,对应音频文件的Tag',
|
|
|
|
|
`no` int(10) unsigned DEFAULT NULL COMMENT '表示歌曲属于CD中第几曲,0表示没有这个字段,对应音频文件的Tag',
|
|
|
|
|
`dj_id` int(10) unsigned DEFAULT NULL COMMENT '0: 不是DJ节目 其他:是DJ节目,表示DJ ID',
|
|
|
|
|
`s_id` int(10) unsigned DEFAULT NULL COMMENT '对于t == 2的歌曲,表示匹配到的公开版本歌曲ID',
|
|
|
|
|
`origin_cover_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0: 未知 1: 原曲 2: 翻唱',
|
|
|
|
|
`image` varchar(200)DEFAULT NULL COMMENT '封面图 http://p1.music.126.net/ 后面的部分',
|
|
|
|
|
`pub_date` varchar(100)DEFAULT NULL COMMENT '发布日期(弃用)',
|
|
|
|
|
`pub_time` bigint(20) unsigned DEFAULT NULL COMMENT '发布日期 毫秒为单位的Unix时间戳',
|
|
|
|
|
`no_copyright_rcmd` varchar(255) DEFAULT NULL COMMENT 'None表示可以播,非空表示无版权',
|
|
|
|
|
`mv` int(10) unsigned DEFAULT NULL COMMENT '非零表示有MV ID',
|
|
|
|
|
`single` tinyint(4) DEFAULT NULL COMMENT '0: 有专辑信息或者是DJ节目 1: 未知专辑',
|
|
|
|
|
`version` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '歌曲版本信息',
|
2022-09-30 08:06:14 +08:00
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-17 21:29:23 +08:00
|
|
|
|
`data_version` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据记录版本(如果有字段调整则整体+1)',
|
2022-10-08 21:57:22 +08:00
|
|
|
|
PRIMARY KEY (`song_id`),
|
|
|
|
|
KEY `song_id` (`song_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
2022-09-30 08:06:14 +08:00
|
|
|
|
|
|
|
|
|
CREATE TABLE `artist` (
|
|
|
|
|
`artist_id` int(10) unsigned NOT NULL COMMENT '歌手id',
|
2022-10-01 18:53:19 +08:00
|
|
|
|
`title` varchar(200) NOT NULL COMMENT '歌手名',
|
|
|
|
|
`description` varchar(1500) NOT NULL COMMENT '歌手简介',
|
|
|
|
|
`image` varchar(200) NOT NULL COMMENT '封面图 http://p1.music.126.net/ 后面的部分',
|
|
|
|
|
`pub_date` varchar(100) NOT NULL COMMENT '发布日期',
|
2022-09-30 08:06:14 +08:00
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY (`artist_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `artist_id` (`artist_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
2022-09-30 08:06:14 +08:00
|
|
|
|
|
|
|
|
|
CREATE TABLE `album` (
|
|
|
|
|
`album_id` int(10) unsigned NOT NULL COMMENT '专辑id',
|
2022-10-01 18:53:19 +08:00
|
|
|
|
`title` varchar(200) NOT NULL COMMENT '专辑名',
|
|
|
|
|
`description` varchar(1500) NOT NULL COMMENT '专辑简介',
|
|
|
|
|
`full_description` text COMMENT '专辑简介(全)',
|
|
|
|
|
`image` varchar(200) NOT NULL COMMENT '封面图 http://p1.music.126.net/ 后面的部分',
|
|
|
|
|
`pub_date` varchar(100) NOT NULL COMMENT '发布日期',
|
|
|
|
|
`company` varchar(100) DEFAULT NULL COMMENT '发行公司',
|
2022-09-30 08:06:14 +08:00
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-04 13:54:21 +08:00
|
|
|
|
`version` tinyint(4) NOT NULL DEFAULT 1 COMMENT '数据记录版本(如果有字段调整则整体+1)',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY (`album_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `album_id` (`album_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
2022-09-30 08:06:14 +08:00
|
|
|
|
|
|
|
|
|
CREATE TABLE `song_album_relation` (
|
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
|
|
|
|
`album_id` int(10) unsigned NOT NULL COMMENT '专辑id',
|
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY (`song_id`,`album_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `song_id` (`song_id`),
|
|
|
|
|
KEY `album_id` (`album_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
2022-09-30 08:06:14 +08:00
|
|
|
|
|
|
|
|
|
CREATE TABLE `song_artist_relation` (
|
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
|
|
|
|
`artist_id` int(10) unsigned NOT NULL COMMENT '歌手id',
|
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY `song_id` (`song_id`,`artist_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `song_id` (`song_id`),
|
|
|
|
|
KEY `artist_id` (`artist_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
2022-10-01 16:16:39 +08:00
|
|
|
|
|
|
|
|
|
CREATE TABLE `lyric` (
|
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
2022-10-03 14:32:04 +08:00
|
|
|
|
`version` int(10) unsigned NOT NULL COMMENT '歌词版本 -1代表没有数据',
|
2022-10-01 21:09:05 +08:00
|
|
|
|
`lyric` text NOT NULL COMMENT '歌词',
|
2022-10-01 16:16:39 +08:00
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY (`song_id`,`version`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `song_id` (`song_id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
|
|
2022-10-02 17:37:28 +08:00
|
|
|
|
CREATE TABLE `user` (
|
2022-10-02 19:16:41 +08:00
|
|
|
|
`user_id` bigint(20) unsigned NOT NULL COMMENT '用户id',
|
|
|
|
|
`user_type` varchar(50) NOT NULL COMMENT '用户类型',
|
2022-10-02 17:37:28 +08:00
|
|
|
|
`nickname` varchar(200) NOT NULL COMMENT '用户昵称',
|
|
|
|
|
`avatar_url` varchar(200) NOT NULL COMMENT '用户头像 http://p1.music.126.net/ 后面的部分',
|
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-06 14:01:05 +08:00
|
|
|
|
PRIMARY KEY (`user_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `user_id` (`user_id`)
|
2022-10-02 17:37:28 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE `comment` (
|
|
|
|
|
`comment_id` bigint(20) unsigned NOT NULL COMMENT '评论id',
|
2022-10-02 19:16:41 +08:00
|
|
|
|
`parent_comment_id` bigint(20) unsigned NOT NULL COMMENT '父评论id',
|
|
|
|
|
`user_id` bigint(20) unsigned NOT NULL COMMENT '用户id',
|
2022-10-02 17:37:28 +08:00
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
|
|
|
|
`content` text NOT NULL COMMENT '评论内容',
|
|
|
|
|
`time` varchar(50) NOT NULL DEFAULT '' COMMENT '评论时间',
|
2022-10-03 14:32:04 +08:00
|
|
|
|
`like_count` int(11) NOT NULL COMMENT '点赞数',
|
2022-10-02 17:37:28 +08:00
|
|
|
|
`comment_type` tinyint(4) unsigned NOT NULL COMMENT '评论类型 0-comments 1-hotComments 2-topComments',
|
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-05 11:41:30 +08:00
|
|
|
|
PRIMARY KEY (`comment_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `song_id` (`song_id`)
|
2022-10-02 17:37:28 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
|
|
|
|
|
|
CREATE TABLE `comment_progress` (
|
|
|
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
2022-10-02 19:16:41 +08:00
|
|
|
|
`max_time` bigint(20) NOT NULL DEFAULT 0 COMMENT '开始爬取/开始增量爬取的时候 最新一条评论的时间',
|
|
|
|
|
`min_time` bigint(20) NOT NULL DEFAULT 0 COMMENT '上一次爬取时最后一条评论的时间 第一次爬取时为0',
|
|
|
|
|
`current_time` bigint(20) NOT NULL DEFAULT 0 COMMENT '本次爬取/增量时,最早的一条评论时间',
|
2022-10-02 17:37:28 +08:00
|
|
|
|
`current_status` tinyint(4) unsigned NOT NULL DEFAULT 0 COMMENT '爬取进度 0-等待爬取/增量爬取 1-爬取中 2-完成',
|
|
|
|
|
`total` int(10) NOT NULL DEFAULT 0 COMMENT '评论总数',
|
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
2022-10-04 13:54:21 +08:00
|
|
|
|
PRIMARY KEY (`song_id`),
|
2022-10-08 21:57:22 +08:00
|
|
|
|
KEY `current_status` (`current_status`)
|
2022-10-02 17:37:28 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
|
|
2022-10-01 18:53:19 +08:00
|
|
|
|
CREATE TABLE `log` (
|
|
|
|
|
`id` int(10) unsigned NOT NULL COMMENT 'id',
|
|
|
|
|
`name` varchar(200) NOT NULL COMMENT '方法/数据库',
|
|
|
|
|
`msg` varchar(200) NOT NULL COMMENT '出错信息',
|
2022-10-08 21:57:22 +08:00
|
|
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
|
|
|
KEY `id` (`id`)
|
2022-10-01 18:53:19 +08:00
|
|
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|