 # Dump of table article_images
 # ------------------------------------------------------------
 
+DROP TABLE IF EXISTS `article_images`;
+
 CREATE TABLE `article_images` (
   `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
   `article_id` bigint(20) unsigned DEFAULT NULL,


DELIMITER ;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`gotcha-admin`@`%` */ /*!50003 TRIGGER `insert_articles_history` AFTER INSERT ON `articles` FOR EACH ROW BEGIN
    INSERT INTO articles_history (title, content, writer, url, category, writed_at)
    VALUES (NEW.title, NEW.content, NEW.writer, NEW.url, NEW.category, NEW.writed_at);
END */;;
/*!50003 SET SESSION SQL_MODE="" */;;
/*!50003 CREATE */ /*!50017 DEFINER=`gotcha-admin`@`%` */ /*!50003 TRIGGER `update_articles_history` AFTER UPDATE ON `articles` FOR EACH ROW BEGIN
    INSERT INTO articles_history (title, content, writer, url, category, writed_at)
    VALUES (NEW.title, NEW.content, NEW.writer, NEW.url, NEW.category, NEW.writed_at);
END */;;
DELIMITER ;
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE */;

# Dump of table articles_history
# ------------------------------------------------------------

DROP TABLE IF EXISTS `articles_history`;

CREATE TABLE `articles_history` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `title` text NOT NULL,
  `content` longtext NOT NULL,
  `writer` varchar(64) NOT NULL DEFAULT '',
  `url` varchar(240) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `category` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '',
  `writed_at` datetime NOT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
