-- https://www.phpmyadmin.net/
--
-- Hôte : 127.0.0.1:3306
-- Généré le :  jeu. 25 mars 2021 à 14:33
-- Version du serveur :  5.7.26
-- Version de PHP :  7.3.5

START TRANSACTION;



--
-- Base de données :  `blog_tests`
--

-- --------------------------------------------------------

--
-- Structure de la table `articles`
--

CREATE TABLE IF NOT EXISTS `articles` (
  `id_article` int(11) NOT NULL AUTO_INCREMENT,
  `id_categorie` int(11) DEFAULT NULL,
  `title` tinytext NOT NULL,
  `tags` text,
  `cover_image` varchar(255) NOT NULL,
  `date_publication` varchar(50) NOT NULL,
  `intro_text` text NOT NULL,
  `body_texts` text,
  `body_titles` text,
  `body_images` text,
  `body_galeries` text,
  `body_cta` text,
  `body_links` text,
  `body_videos` text,
  `body_pdf` text,
  `body_html_element` text,
  `lectures` int(11) DEFAULT '0',
  `auteur` varchar(255) NOT NULL,
  `id_user` int(11) NOT NULL,
  `is_active` tinyint(4) DEFAULT '0',
  `featured` tinyint(4) DEFAULT '0',
  `slug` varchar(255) NOT NULL,
  PRIMARY KEY (`id_article`),
  KEY `id_categorie` (`id_categorie`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


-- --------------------------------------------------------

--
-- Structure de la table `categories`
--

CREATE TABLE IF NOT EXISTS `categories` (
  `id_categorie` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) NOT NULL,
  `slug` varchar(150) NOT NULL,
  PRIMARY KEY (`id_categorie`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Structure de la table `options`
--

CREATE TABLE IF NOT EXISTS `options` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `article_type` tinyint(4) DEFAULT 0,
  `products_show_weight` tinyint(4) DEFAULT 0,
  `products_show_prices` tinyint(4) DEFAULT 1,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

--
-- Déchargement des données de la table `options`
--

INSERT INTO `options` (`id`, `article_type`, `products_show_weight`, `products_show_prices`) VALUES
(1, 1, 1, 1);

-- --------------------------------------------------------

--
-- Structure de la table `tags`
--

CREATE TABLE IF NOT EXISTS `tags` (
  `id_tag` int(11) NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id_tag`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Structure de la table `products`
--

CREATE TABLE IF NOT EXISTS `products` (
  `id_product` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) NOT NULL,
  `slug` varchar(150) NOT NULL,
  `description` text,
  `price_1` varchar(16),
  `price_2` varchar(16),
  `price_3` varchar(16),
  `weight` varchar(64),
  `options` text NOT NULL,
  PRIMARY KEY (`id_product`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Structure de la table `product_options`
--

CREATE TABLE IF NOT EXISTS `product_options` (
  `id_option` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(150) NOT NULL,
  `slug` varchar(150) NOT NULL,
  PRIMARY KEY (`id_option`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Structure de la table `product_categories`
--

CREATE TABLE IF NOT EXISTS `product_categories` (
  `id_category` int(11) NOT NULL AUTO_INCREMENT,
  `display_order` int(11) NOT NULL,
  `name` varchar(150) NOT NULL,
  `slug` varchar(150) NOT NULL,
  `text_1` text,
  `text_2` text,
  `products` text NOT NULL,
  `price_1_name` varchar(32),
  `price_2_name` varchar(32),
  `price_3_name` varchar(32),
  `price` varchar(16),
  PRIMARY KEY (`id_category`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Contraintes pour la table `articles`
--
ALTER TABLE `articles`
  ADD CONSTRAINT `Categorie used in article` FOREIGN KEY (`id_categorie`) REFERENCES `categories` (`id_categorie`) ON UPDATE NO ACTION;
COMMIT;

