<?php

$querys = array();

$querys[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."chcreaposts` (
  `id_chcreaposts` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `post_author` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `post_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `comment_status` varchar(20) NOT NULL DEFAULT 'open',
  `post_password` varchar(20) NOT NULL DEFAULT '',
  `post_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `post_format` varchar(20) NOT NULL DEFAULT 'post',
  `post_img` varchar(300) NOT NULL DEFAULT '',
  `video` longtext NOT NULL,
  `audio` longtext NOT NULL,
  `gallery` longtext NOT NULL,
  `related_products` longtext NOT NULL,
  `comment_count` bigint(20) NOT NULL DEFAULT '0',
  `position`int(10) NOT NULL ,
  `active` int(10) NOT NULL,
  PRIMARY KEY (`id_chcreaposts`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";

$querys[] = "CREATE TABLE IF NOT EXISTS `"._DB_PREFIX_."chcreaposts_lang` (
  `id_chcreaposts` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_lang` int(10) unsigned NOT NULL,
  `post_title` text NOT NULL,
  `meta_title` varchar(300) NOT NULL DEFAULT '',
  `meta_description` longtext NOT NULL,
  `meta_keyword` longtext NOT NULL,
  `post_content` longtext NOT NULL,
  `post_excerpt` text NOT NULL,
  `link_rewrite` varchar(400) NOT NULL DEFAULT '',
   PRIMARY KEY (`id_chcreaposts`, `id_lang`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";

$querys[] = "CREATE TABLE IF NOT EXISTS `" . _DB_PREFIX_ . "chcreaposts_shop` (
	`id_chcreaposts` int(11) NOT NULL,
	`id_shop` int(11) unsigned NOT NULL,
	PRIMARY KEY (`id_chcreaposts`,`id_shop`)
)ENGINE=" . _MYSQL_ENGINE_ . " DEFAULT CHARSET=utf8" ;

$querys[] = "CREATE TABLE  IF NOT EXISTS `"._DB_PREFIX_."chcrea_images` (
  `id_images` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `id_chcreaposts` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `name` varchar(300) NOT NULL,
  `type` varchar(20) NOT NULL DEFAULT 'post',
   PRIMARY KEY (`id_images`)
) ENGINE="._MYSQL_ENGINE_." DEFAULT CHARSET=utf8";


$querys[] = "CREATE TABLE  IF NOT EXISTS `"._DB_PREFIX_."chcrea_image_type`(
  `id_image_type` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(100) DEFAULT NULL,
  `width` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `height` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `id_shop` int(11) UNSIGNED NOT NULL DEFAULT '0',
  `active` int(11) UNSIGNED NOT NULL DEFAULT '1',
  PRIMARY KEY (`id_image_type`)
) ENGINE=" . _MYSQL_ENGINE_ . " DEFAULT CHARSET=utf8";

$querys[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'chcrea_comments`(
  `id_comments` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(256) DEFAULT NULL,
  `email` varchar(90) DEFAULT NULL,
  `subject` varchar(256) DEFAULT NULL,
  `website` varchar(128) DEFAULT NULL,
  `content` text,
  `id_parent` int(11) DEFAULT NULL,
  `id_chcreaposts` int(11) DEFAULT NULL,
  `id_customer` int(11) DEFAULT NULL,
  `id_guest` int(11) DEFAULT NULL,
  `active` int(11) DEFAULT NULL,
  `position` int(11) DEFAULT NULL,
  `uniqueid` int(11) DEFAULT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL,
  PRIMARY KEY (`id_comments`)
) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8' ;

$querys_u = array();

$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts`';
$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts_lang`';
$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcreaposts_shop`';
$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_images`';
$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_image_type`';
$querys_u[] = 'DROP TABLE IF EXISTS `'._DB_PREFIX_.'chcrea_comments`';

