CREATE TABLE IF NOT EXISTS `PREFIX_projectproblog_category` (
    `id_category`   INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `id_parent`     INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `active`        TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
    `position`      INT(10) UNSIGNED NOT NULL DEFAULT 0,
    `date_add`      DATETIME NOT NULL,
    `date_upd`      DATETIME NOT NULL,
    PRIMARY KEY (`id_category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_projectproblog_category_lang` (
    `id_category`        INT(10) UNSIGNED NOT NULL,
    `id_lang`            INT(10) UNSIGNED NOT NULL,
    `name`               VARCHAR(255) NOT NULL,
    `description`        TEXT,
    `link_rewrite`       VARCHAR(255) NOT NULL,
    `meta_title`         VARCHAR(255),
    `meta_keywords`      VARCHAR(255),
    `meta_description`   VARCHAR(512),
    PRIMARY KEY (`id_category`, `id_lang`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_projectproblog_post` (
    `id_post`    INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
    `active`     TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
    `thumbnail`  VARCHAR(255) DEFAULT NULL,
    `date_add`   DATETIME NOT NULL,
    `date_upd`   DATETIME NOT NULL,
    PRIMARY KEY (`id_post`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_projectproblog_post_lang` (
    `id_post`            INT(10) UNSIGNED NOT NULL,
    `id_lang`            INT(10) UNSIGNED NOT NULL,
    `title`              VARCHAR(255) NOT NULL,
    `intro`              TEXT,
    `content`            LONGTEXT,
    `link_rewrite`       VARCHAR(255) NOT NULL,
    `meta_title`         VARCHAR(255),
    `meta_keywords`      VARCHAR(255),
    `meta_description`   VARCHAR(512),
    PRIMARY KEY (`id_post`, `id_lang`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

CREATE TABLE IF NOT EXISTS `PREFIX_projectproblog_post_category` (
    `id_post`     INT(10) UNSIGNED NOT NULL,
    `id_category` INT(10) UNSIGNED NOT NULL,
    PRIMARY KEY (`id_post`, `id_category`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
