68 lines
3.9 KiB
SQL
68 lines
3.9 KiB
SQL
CREATE DATABASE `neteaseMusic` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci';
|
|
USE `neteaseMusic`;
|
|
CREATE TABLE `song` (
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
|
`title` varchar(200) NOT NULL COMMENT '歌曲名',
|
|
`image` varchar(200) NOT NULL COMMENT '封面图 http://p1.music.126.net/ 后面的部分',
|
|
`pub_date` varchar(100) 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`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `artist` (
|
|
`artist_id` int(10) unsigned NOT NULL COMMENT '歌手id',
|
|
`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 '发布日期',
|
|
`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`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `album` (
|
|
`album_id` int(10) unsigned NOT NULL COMMENT '专辑id',
|
|
`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 '发行公司',
|
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '爬取时间',
|
|
`modify_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后更新时间',
|
|
`version` tinyint(4) NOT NULL DEFAULT '1' COMMENT '数据记录版本(如果有字段调整则整体+1)',
|
|
PRIMARY KEY (`album_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
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`,`album_id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
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`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
|
|
|
CREATE TABLE `lyric` (
|
|
`song_id` int(10) unsigned NOT NULL COMMENT '歌曲id',
|
|
`version` int(10) unsigned NOT NULL COMMENT '歌词版本',
|
|
`lyric` text 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`,`version`)
|
|
) 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; |