'SET foreign_key_checks=0;

--
-- Table: `articles`
--
CREATE TABLE `articles` (
  `body` varchar(255) NOT NULL,
  `createdAt` datetime NOT NULL,
  `description` varchar(255) NOT NULL,
  `favorited` tinyint NOT NULL,
  `favoritesCount` integer NOT NULL,
  `id` integer NOT NULL auto_increment,
  `slug` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `updatedAt` datetime NOT NULL,
  `article_id` integer NOT NULL,
  `author_id` integer NOT NULL,
  INDEX `pk_id` (`id`),
  INDEX (`article_id`),
  INDEX (`author_id`),
  PRIMARY KEY (`id`),
  CONSTRAINT `articles_fk` FOREIGN KEY (`article_id`) REFERENCES `multiple_articles_responses` (`id`),
  CONSTRAINT `articles_fk_1` FOREIGN KEY (`author_id`) REFERENCES `profiles` (`id`)
) ENGINE=InnoDB;

--
-- Table: `article_tag_lists`
--
CREATE TABLE `article_tag_lists` (
  `id` integer NOT NULL auto_increment,
  `value` varchar(255) NOT NULL,
  `tagList_id` integer NOT NULL,
  INDEX `pk_id` (`id`),
  INDEX (`tagList_id`),
  PRIMARY KEY (`id`),
  CONSTRAINT `article_tag_lists_fk` FOREIGN KEY (`tagList_id`) REFERENCES `articles` (`id`)
) ENGINE=InnoDB;

--
-- Table: `comments`
--
CREATE TABLE `comments` (
  `body` varchar(255) NOT NULL,
  `createdAt` datetime NOT NULL,
  `id` integer NOT NULL auto_increment,
  `updatedAt` datetime NOT NULL,
  `author_id` integer NOT NULL,
  INDEX `pk_id` (`id`),
  INDEX (`author_id`),
  PRIMARY KEY (`id`),
  CONSTRAINT `comments_fk` FOREIGN KEY (`author_id`) REFERENCES `profiles` (`id`)
) ENGINE=InnoDB;

--
-- Table: `multiple_articles_responses`
--
CREATE TABLE `multiple_articles_responses` (
  `articlesCount` integer NOT NULL,
  `id` integer NOT NULL auto_increment,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

--
-- Table: `new_users`
--
CREATE TABLE `new_users` (
  `email` varchar(255) NOT NULL,
  `id` integer NOT NULL auto_increment,
  `password` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
);

--
-- Table: `profiles`
--
CREATE TABLE `profiles` (
  `bio` varchar(255) NOT NULL,
  `following` tinyint NOT NULL,
  `id` integer NOT NULL auto_increment,
  `image` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;

--
-- Table: `users`
--
CREATE TABLE `users` (
  `bio` varchar(255) NOT NULL,
  `email` varchar(255) NOT NULL,
  `id` integer NOT NULL auto_increment,
  `image` varchar(255) NOT NULL,
  `token` varchar(255) NOT NULL,
  `username` varchar(255) NOT NULL,
  INDEX `pk_id` (`id`),
  PRIMARY KEY (`id`)
);

SET foreign_key_checks=1;'
