
CREATE TABLE `audio` (
  `id` int(6) NOT NULL,
  `author_name` varchar(15) NOT NULL,
  `audio_name` varchar(30) NOT NULL,
  `date_added` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  `likes` int(6) NOT NULL,
  `user_id` int(6) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `audio` (`id`, `author_name`, `audio_name`, `date_added`, `likes`, `user_id`) VALUES
(1, 'Paul', 'Ukulele', '2018-09-10 22:59:44.000000', 5, 5),
(2, 'Kevin', 'Applause', '2018-09-10 23:00:12.000000', 7, 1),
(3, 'Kevin Hart', 'Wi Fi', '2018-09-10 23:01:37.000000', 100, 3),
(4, 'Jeff Ross', 'Roasts America', '2018-09-10 23:02:10.000000', 87, 4),
(5, 'Mike', 'Laugh', '2018-09-10 23:03:11.000000', 10, 2),
(6, 'Matt', 'Better Days', '2018-09-10 23:03:11.000000', 22, 6);

CREATE TABLE `comments` (
  `id` int(4) NOT NULL,
  `comment` varchar(150) NOT NULL,
  `comment_time` decimal(8,0) NOT NULL,
  `audio_id` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `hearts` (
  `user_id` int(4) NOT NULL,
  `fill` int(2) NOT NULL,
  `audio_id` int(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE `user_feedback` (
  `id` int(6) NOT NULL,
  `liked` tinyint(1) DEFAULT NULL,
  `audio_id` int(4) NOT NULL COMMENT 'audi_id',
  `user_id` tinyint(4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `user_feedback` (`id`, `liked`, `audio_id`, `user_id`) VALUES
(1, 1, 4, 3),
(2, 0, 2, 5),
(3, NULL, 3, 6);


ALTER TABLE `audio`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `comments`
  ADD PRIMARY KEY (`id`);

ALTER TABLE `hearts`
  ADD PRIMARY KEY (`user_id`);

ALTER TABLE `user_feedback`
  ADD PRIMARY KEY (`id`);


ALTER TABLE `audio`
  MODIFY `id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

ALTER TABLE `comments`
  MODIFY `id` int(4) NOT NULL AUTO_INCREMENT;

ALTER TABLE `hearts`
  MODIFY `user_id` int(4) NOT NULL AUTO_INCREMENT;

ALTER TABLE `user_feedback`
  MODIFY `id` int(6) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
