   `entry_url_source` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
   `entry_screenshot_url` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
   `entry_color` varchar(45) COLLATE utf8mb4_bin DEFAULT 'FFFFFF',
-  `entry_deleted` tinyint(1) DEFAULT '0',
-  PRIMARY KEY (`entry_id`)
-) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-
-DELIMITER ;;
-CREATE TRIGGER entry_insert AFTER INSERT ON `entry` FOR EACH ROW 
-BEGIN
+  `entry_deleted` tinyint(1) DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+--
+-- Triggers `entry`
+--
+DELIMITER $$
+CREATE TRIGGER `entry_delete` BEFORE DELETE ON `entry` FOR EACH ROW BEGIN
+    INSERT INTO `entry_changelog`
+		(`change_id`,
+		`change_type`,
+		`change_datetime`,
+		`entry_id`,
+		`entry_datetime`,
+		`entry_ip`,
+		`entry_user_agent`,
+		`entry_jam_id`,
+		`entry_jam_number`,
+		`entry_title`,
+		`entry_description`,
+		`entry_author`,
+		`entry_url`,
+		`entry_url_web`,
+		`entry_url_windows`,
+		`entry_url_linux`,
+		`entry_url_mac`,
+		`entry_url_android`,
+		`entry_url_ios`,
+		`entry_url_source`,
+		`entry_screenshot_url`,
+		`entry_color`,
+		`entry_deleted`)
+	VALUES
+		(null,
+		"DELETE",
+		Now(),
+		old.entry_id,
+		old.entry_datetime,
+		old.entry_ip,
+		old.entry_user_agent,
+		old.entry_jam_id,
+		old.entry_jam_number,
+		old.entry_title,
+		old.entry_description,
+		old.entry_author,
+		old.entry_url,
+		old.entry_url_web,
+		old.entry_url_windows,
+		old.entry_url_linux,
+		old.entry_url_mac,
+		old.entry_url_android,
+		old.entry_url_ios,
+		old.entry_url_source,
+		old.entry_screenshot_url,
+		old.entry_color,
+		old.entry_deleted);
+END
+$$
+DELIMITER ;
+DELIMITER $$
+CREATE TRIGGER `entry_insert` AFTER INSERT ON `entry` FOR EACH ROW BEGIN
     INSERT INTO `entry_changelog`
 		(`change_id`,
 		`change_type`,

--

CREATE TABLE `asset` (
  `asset_id` int(11) NOT NULL AUTO_INCREMENT,
  `asset_datetime` datetime NOT NULL,
  `asset_ip` varchar(45) COLLATE utf8mb4_bin NOT NULL,
  `asset_user_agent` varchar(255) COLLATE utf8mb4_bin NOT NULL,

  `user_email` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `user_twitter` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `user_bio` mediumtext COLLATE utf8mb4_bin,
  `user_role` int(11) DEFAULT '0'
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `asset`
--
ALTER TABLE `asset`
  ADD PRIMARY KEY (`asset_id`);

--
-- Indexes for table `entry`
--
ALTER TABLE `entry`
  ADD PRIMARY KEY (`entry_id`);

--
-- Indexes for table `entry_changelog`
--
ALTER TABLE `entry_changelog`
  ADD PRIMARY KEY (`change_id`);

--
-- Indexes for table `jam`
--
ALTER TABLE `jam`
  ADD PRIMARY KEY (`jam_id`);

--
-- Indexes for table `poll`
--
ALTER TABLE `poll`
  ADD PRIMARY KEY (`poll_id`);

--
-- Indexes for table `poll_option`
--
ALTER TABLE `poll_option`
  ADD PRIMARY KEY (`option_id`);

--
-- Indexes for table `poll_vote`
--
ALTER TABLE `poll_vote`
  ADD PRIMARY KEY (`vote_id`);

--
-- Indexes for table `satisfaction`
--
ALTER TABLE `satisfaction`
  ADD PRIMARY KEY (`satisfaction_id`);

--
-- Indexes for table `session`
--
ALTER TABLE `session`
  ADD PRIMARY KEY (`session_id`);

--
-- Indexes for table `theme`
--
ALTER TABLE `theme`
  ADD PRIMARY KEY (`theme_id`);

--
-- Indexes for table `themevote`
--
ALTER TABLE `themevote`
  ADD PRIMARY KEY (`themevote_id`);

--
-- Indexes for table `user`
--
ALTER TABLE `user`
  ADD PRIMARY KEY (`user_id`),
  ADD UNIQUE KEY `user_username_UNIQUE` (`user_username`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `asset`
--
ALTER TABLE `asset`
  MODIFY `asset_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;

--
-- AUTO_INCREMENT for table `entry`
--
ALTER TABLE `entry`
  MODIFY `entry_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3029;

--
-- AUTO_INCREMENT for table `entry_changelog`
--
ALTER TABLE `entry_changelog`
  MODIFY `change_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7687;

--
-- AUTO_INCREMENT for table `jam`
--
ALTER TABLE `jam`
  MODIFY `jam_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=525;

--
-- AUTO_INCREMENT for table `poll`
--
ALTER TABLE `poll`
  MODIFY `poll_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `poll_option`
--
ALTER TABLE `poll_option`
  MODIFY `option_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;

--
-- AUTO_INCREMENT for table `poll_vote`
--
ALTER TABLE `poll_vote`
  MODIFY `vote_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=126;

--
-- AUTO_INCREMENT for table `satisfaction`
--
ALTER TABLE `satisfaction`
  MODIFY `satisfaction_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=231;

--
-- AUTO_INCREMENT for table `theme`
--
ALTER TABLE `theme`
  MODIFY `theme_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1222;

--
-- AUTO_INCREMENT for table `themevote`
--
ALTER TABLE `themevote`
  MODIFY `themevote_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=26526;

--
-- AUTO_INCREMENT for table `user`
--
ALTER TABLE `user`
  MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1408;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
