1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee
tools/netease_music/sql/structure.sql

68 lines
3.9 KiB
MySQL
Raw Normal View History

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-01 18:53:19 +08:00
`title` varchar(200) 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 '最后更新时间',
PRIMARY KEY (`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 '最后更新时间',
PRIMARY KEY (`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-01 18:53:19 +08:00
`version` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据记录版本(如果有字段调整则整体+1)',
2022-09-30 08:06:14 +08:00
PRIMARY KEY (`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 '最后更新时间',
PRIMARY KEY `song_id` (`song_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 '最后更新时间',
PRIMARY KEY `song_id` (`song_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-01 18:53:19 +08:00
`lyric` text NOT NULL COMMENT '歌词',
2022-10-01 16:16:39 +08:00
`version` int(10) unsigned NOT NULL COMMENT '版本号',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
PRIMARY KEY (`song_id`)
2022-10-01 18:53:19 +08:00
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE `log` (
`id` int(10) unsigned NOT NULL COMMENT 'id',
`name` varchar(200) NOT NULL COMMENT '方法/数据库',
`msg` varchar(200) NOT NULL COMMENT '出错信息',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;