CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_products`(
			`id_product` int(10) NOT NULL default '0',
			`config` text,
			PRIMARY KEY (`id_product`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_settings`(
			`id_setting` INT(10) unsigned NOT NULL auto_increment,
			`id_product` int(10) NOT NULL default '0',
			`config` text,
			PRIMARY KEY (`id_setting`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_bases`(
			`id_mdb` INT(10) unsigned NOT NULL auto_increment,
			`id_product` int(10) NOT NULL default '0',
			`title` varchar(128) NOT NULL,
			`position` smallint(2) NOT NULL default '0', 
			PRIMARY KEY (`id_mdb`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;			
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_views`(
			`id_view` INT(10) unsigned NOT NULL auto_increment,
			`id_mdb` int(10) NOT NULL default '0',
			`title` varchar(128) NOT NULL,
			`position` smallint(2) NOT NULL default '0', 
			PRIMARY KEY (`id_view`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_elements`(
			`id_element` INT(10) unsigned NOT NULL auto_increment,
			`id_view` INT(10) unsigned NOT NULL default '0',
			`title` varchar(128) NOT NULL,
			`type` varchar(128) NOT NULL,
			`price` decimal(20,6) NOT NULL default '0',
			`attributes` varchar(128),
			`position` smallint(2) NOT NULL default '0', 
			`config` text,
			PRIMARY KEY (`id_element`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_carts` (
			`id_mdc` INT(10) unsigned NOT NULL auto_increment,
			`id_megacart` int(11) NOT NULL,
			`id_cart` int(11) NOT NULL,
			`id_product` int(11) NOT NULL,
			`id_product_attribute` int(11) NOT NULL,
			`config` longtext,
			 PRIMARY KEY (`id_mdc`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_categories`(
			`id_mdct` INT(10) unsigned NOT NULL auto_increment,
			`name` varchar(128) NOT NULL,
			`public` smallint(2) NOT NULL default '1', 
			`position` smallint(2) NOT NULL default '0', 
			PRIMARY KEY (`id_mdct`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_categories_lang` 
(
	`id_mdct` int(10) unsigned NOT NULL auto_increment,
	`id_lang` int(11) NOT NULL,
	`public_title` varchar(256),
	PRIMARY KEY (`id_mdct`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_designs`(
			`id_design` INT(10) unsigned NOT NULL auto_increment,
			`id_mdct` int(11) NOT NULL,
			`name` varchar(128) NOT NULL,
			`position` smallint(2) NOT NULL default '0', 
			`config` text,
			PRIMARY KEY (`id_design`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_designs_lang` 
(
	`id_design` int(10) unsigned NOT NULL auto_increment,
	`id_lang` int(11) NOT NULL,
	`public_name` varchar(256),
	PRIMARY KEY (`id_design`,`id_lang`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_savedproducts` (
			`id_mdsp` INT(10) unsigned NOT NULL auto_increment,
			`id_customer` int(11) NOT NULL,
			`id_product` int(11) NOT NULL,
			`config` longtext,
			 PRIMARY KEY (`id_mdsp`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_customelements`(
			`id_customelement` INT(10) unsigned NOT NULL auto_increment,
			`title` varchar(128) NOT NULL,
			`type` varchar(128) NOT NULL,
			`config` text,
			PRIMARY KEY (`id_customelement`)
			) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS `PREFIX_megadesigner_productcategories` (
	`id_product` int(11) NOT NULL AUTO_INCREMENT,
	`categories` varchar(256),
	`config` text,
  PRIMARY KEY (`id_product`)
) DEFAULT CHARSET=utf8;