DROP TABLE IF EXISTS categories;
CREATE TABLE categories
(
  id              smallint unsigned NOT NULL auto_increment,
  `name`          varchar(255) NOT NULL,                      # Name of the category
  description     text NOT NULL,                              # A short description of the category

  PRIMARY KEY     (id)
);

DROP TABLE IF EXISTS articles;
CREATE TABLE articles
(
  id              smallint unsigned NOT NULL auto_increment,
  publicationDate date NOT NULL,                              # When the article was published
  categoryId      smallint unsigned NOT NULL,                 # The article category ID
  title           varchar(255) NOT NULL,                      # Full title of the article
  summary         text NOT NULL,                              # A short summary of the article
  content         mediumtext NOT NULL,                        # The HTML content of the article
  imageExtension  varchar(255) NOT NULL,                      # The filename extension of the article's full-size and thumbnail images
  PRIMARY KEY     (id)
);

# CREATE USER 'cms'@'localhost' IDENTIFIED BY 'SJ6G*WyaV7PvvEts@vxjm';

# GRANT ALL ON cms.* TO 'cms'@'localhost';

# create database cms;