-- --------------------------------------------------------
-- Versione server:              10.1.11-MariaDB - MariaDB Server
-- S.O. server:                  Linux
-- HeidiSQL Versione:            9.3.0.5045
-- --------------------------------------------------------


-- Dump della struttura di tabella ActivityLog
CREATE TABLE IF NOT EXISTS `ActivityLog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `sid` varchar(64) NOT NULL,
  `userId` int(10) unsigned DEFAULT NULL,
  `referral` varchar(200) DEFAULT NULL,
  `requestedResource` varchar(500) DEFAULT NULL,
  `method` char(3) DEFAULT NULL,
  `actionArgs` varchar(300) DEFAULT NULL,
  `vars` varchar(300) DEFAULT NULL,
  `queryCount` tinyint(4) DEFAULT '0',
  `responseTime` varchar(9) DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ActivityLogOld
CREATE TABLE IF NOT EXISTS `ActivityLogOld` (
  `id` int(11) NOT NULL DEFAULT '0',
  `userId` int(10) unsigned DEFAULT NULL,
  `referral` varchar(200) DEFAULT NULL,
  `requestedResource` varchar(500) DEFAULT NULL,
  `method` char(3) DEFAULT NULL,
  `actionArgs` varchar(300) DEFAULT NULL,
  `vars` varchar(300) DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ApiUser
CREATE TABLE IF NOT EXISTS `ApiUser` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) DEFAULT NULL,
  `token` varchar(64) DEFAULT NULL,
  `password` varchar(60) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ApplicationLog
CREATE TABLE IF NOT EXISTS `ApplicationLog` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `source` varchar(255) NOT NULL,
  `severity` varchar(45) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `message` tinytext,
  `context` text,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `sid` varchar(64) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Article
CREATE TABLE IF NOT EXISTS `Article` (
  `id` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `type` varchar(45) DEFAULT NULL,
  `url` varchar(45) DEFAULT NULL,
  `title` varchar(45) NOT NULL,
  `imgName` varchar(45) DEFAULT NULL,
  `text` mediumtext NOT NULL,
  `lastUpdate` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `creationDate` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`,`langId`),
  KEY `fk_Article_Lang1_idx` (`langId`),
  CONSTRAINT `fk_Article_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Blog
CREATE TABLE IF NOT EXISTS `Blog` (
  `id` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Carrier
CREATE TABLE IF NOT EXISTS `Carrier` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `isActive` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella City
CREATE TABLE IF NOT EXISTS `City` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `provinceId` int(11) NOT NULL,
  `name` varchar(45) NOT NULL,
  `fiscalCode` varchar(10) DEFAULT NULL,
  `population` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_City_Province1_idx` (`provinceId`),
  CONSTRAINT `fk_City_Province1` FOREIGN KEY (`provinceId`) REFERENCES `Province` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Country
CREATE TABLE IF NOT EXISTS `Country` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(100) NOT NULL,
  `shippingCost` int(11) DEFAULT NULL,
  `ISO` varchar(2) DEFAULT NULL,
  `ISO3` varchar(3) DEFAULT NULL,
  `capital` varchar(45) DEFAULT NULL,
  `population` int(11) DEFAULT NULL,
  `continent` varchar(45) DEFAULT NULL,
  `tld` varchar(45) DEFAULT NULL,
  `currencyCode` varchar(45) DEFAULT NULL,
  `currency` varchar(45) DEFAULT NULL,
  `phone` varchar(45) DEFAULT NULL,
  `postCodeFormat` varchar(45) DEFAULT NULL,
  `postCodeRegex` varchar(45) DEFAULT NULL,
  `langs` varchar(45) DEFAULT NULL,
  `geonameId` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella CountryHasLang
CREATE TABLE IF NOT EXISTS `CountryHasLang` (
  `countryId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`countryId`,`langId`),
  KEY `fk_Country_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_Country_has_Lang_Country1_idx` (`countryId`),
  CONSTRAINT `fk_Country_has_Lang_Country1` FOREIGN KEY (`countryId`) REFERENCES `Country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Country_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Coupon
CREATE TABLE IF NOT EXISTS `Coupon` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `couponTypeId` int(10) unsigned NOT NULL,
  `tagId` int(10) unsigned DEFAULT NULL,
  `code` varchar(19) NOT NULL,
  `issueDate` datetime NOT NULL,
  `validThru` datetime DEFAULT NULL,
  `amount` smallint(5) unsigned NOT NULL,
  `amountType` char(1) NOT NULL,
  `userId` int(10) unsigned DEFAULT NULL,
  `valid` binary(1) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_UNIQUE` (`code`),
  KEY `fk_Coupon_CouponType1_idx` (`couponTypeId`),
  KEY `fk_Coupon_Tag1_idx` (`tagId`),
  KEY `userId` (`userId`),
  CONSTRAINT `Coupon_ibfk_1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`),
  CONSTRAINT `fk_Coupon_CouponType1` FOREIGN KEY (`couponTypeId`) REFERENCES `CouponType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Coupon_Tag1` FOREIGN KEY (`tagId`) REFERENCES `Tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella CouponEvent
CREATE TABLE IF NOT EXISTS `CouponEvent` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `couponTypeId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `click` int(10) NOT NULL DEFAULT '0',
  `startDate` datetime NOT NULL,
  `endDate` datetime NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_UNIQUE` (`name`),
  KEY `1_idx` (`couponTypeId`),
  CONSTRAINT `1` FOREIGN KEY (`couponTypeId`) REFERENCES `CouponType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella CouponType
CREATE TABLE IF NOT EXISTS `CouponType` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `amount` smallint(5) unsigned DEFAULT '0',
  `amountType` char(1) NOT NULL DEFAULT 'F',
  `validity` varchar(50) NOT NULL DEFAULT 'P1Y',
  `validForCartTotal` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Currency
CREATE TABLE IF NOT EXISTS `Currency` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(4) NOT NULL,
  `conversionToEur` float NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella CurrencyTranslation
CREATE TABLE IF NOT EXISTS `CurrencyTranslation` (
  `currencyId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`currencyId`,`langId`),
  KEY `7_idx` (`langId`),
  CONSTRAINT `6` FOREIGN KEY (`currencyId`) REFERENCES `Currency` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionaryBrand
CREATE TABLE IF NOT EXISTS `DictionaryBrand` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `productBrandId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_Shop_has_ProductBrand_ProductBrand1_idx` (`productBrandId`),
  KEY `fk_Shop_has_ProductBrand_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_Shop_has_ProductBrand_ProductBrand1` FOREIGN KEY (`productBrandId`) REFERENCES `ProductBrand` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Shop_has_ProductBrand_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionaryCategory
CREATE TABLE IF NOT EXISTS `DictionaryCategory` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(95) NOT NULL,
  `productCategoryId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_ProductCategory_has_Shop_Shop1_idx` (`shopId`),
  KEY `fk_ProductCategory_has_Shop_ProductCategory1_idx` (`productCategoryId`),
  CONSTRAINT `fk_ProductCategory_has_Shop_ProductCategory1` FOREIGN KEY (`productCategoryId`) REFERENCES `ProductCategory` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductCategory_has_Shop_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionaryColorGroup
CREATE TABLE IF NOT EXISTS `DictionaryColorGroup` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `productColorGroupId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_ProductColorGroup_has_Shop_Shop1_idx` (`shopId`),
  KEY `fk_ProductColorGroup_has_Shop_ProductColorGroup1_idx` (`productColorGroupId`),
  CONSTRAINT `fk_ProductColorGroup_has_Shop_ProductColorGroup1` FOREIGN KEY (`productColorGroupId`) REFERENCES `ProductColorGroup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductColorGroup_has_Shop_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionaryDetail
CREATE TABLE IF NOT EXISTS `DictionaryDetail` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `productDetailId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_ProductDetail_has_Shop_Shop1_idx` (`shopId`),
  KEY `fk_ProductDetail_has_Shop_ProductDetail1_idx` (`productDetailId`),
  CONSTRAINT `fk_ProductDetail_has_Shop_ProductDetail1` FOREIGN KEY (`productDetailId`) REFERENCES `ProductDetail` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductDetail_has_Shop_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionarySeason
CREATE TABLE IF NOT EXISTS `DictionarySeason` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `productSeasonId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_Shop_has_ProductSeason_ProductSeason1_idx` (`productSeasonId`),
  KEY `fk_Shop_has_ProductSeason_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_Shop_has_ProductSeason_ProductSeason1` FOREIGN KEY (`productSeasonId`) REFERENCES `ProductSeason` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Shop_has_ProductSeason_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionarySize
CREATE TABLE IF NOT EXISTS `DictionarySize` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `productSizeId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_ProductSize_has_Shop_Shop1_idx` (`shopId`),
  KEY `fk_ProductSize_has_Shop_ProductSize1_idx` (`productSizeId`),
  CONSTRAINT `fk_ProductSize_has_Shop_ProductSize1` FOREIGN KEY (`productSizeId`) REFERENCES `ProductSize` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSize_has_Shop_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DictionaryTag
CREATE TABLE IF NOT EXISTS `DictionaryTag` (
  `shopId` int(10) unsigned NOT NULL,
  `term` varchar(45) NOT NULL,
  `tagId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`shopId`,`term`),
  KEY `fk_Tag_has_Shop_Shop1_idx` (`shopId`),
  KEY `fk_Tag_has_Shop_Tag1_idx` (`tagId`),
  CONSTRAINT `fk_Tag_has_Shop_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Tag_has_Shop_Tag1` FOREIGN KEY (`tagId`) REFERENCES `Tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DirtyDetail
CREATE TABLE IF NOT EXISTS `DirtyDetail` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `dirtyProductId` int(10) unsigned NOT NULL,
  `label` varchar(45) DEFAULT NULL,
  `content` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`,`dirtyProductId`),
  KEY `fk_dirtydetail_idx` (`dirtyProductId`),
  CONSTRAINT `fk_dirtydetail` FOREIGN KEY (`dirtyProductId`) REFERENCES `DirtyProduct` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DirtyPhoto
CREATE TABLE IF NOT EXISTS `DirtyPhoto` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `dirtyProductId` int(10) unsigned NOT NULL,
  `url` varchar(255) DEFAULT NULL,
  `location` varchar(45) DEFAULT NULL,
  `position` varchar(45) DEFAULT NULL,
  `worked` tinyint(1) DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `shopId` int(10) NOT NULL,
  PRIMARY KEY (`id`,`dirtyProductId`),
  KEY `fk_dirtyProduct_id_idx` (`dirtyProductId`),
  CONSTRAINT `fk_dirtyProduct_id` FOREIGN KEY (`dirtyProductId`) REFERENCES `DirtyProduct` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DirtyProduct
CREATE TABLE IF NOT EXISTS `DirtyProduct` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `productId` int(10) unsigned DEFAULT NULL,
  `productVariantId` int(10) unsigned DEFAULT NULL,
  `shopId` int(10) unsigned NOT NULL,
  `extId` varchar(45) DEFAULT NULL,
  `brand` varchar(45) DEFAULT NULL,
  `itemno` varchar(45) DEFAULT NULL,
  `var` varchar(45) DEFAULT NULL,
  `value` double DEFAULT NULL,
  `price` double DEFAULT NULL,
  `salePrice` double DEFAULT NULL,
  `text` text,
  `checksum` char(32) DEFAULT NULL,
  `keysChecksum` char(32) DEFAULT NULL,
  `detailsChecksum` char(32) DEFAULT NULL,
  `photosChecksum` char(32) DEFAULT NULL,
  `sizesChecksum` char(32) DEFAULT NULL,
  `fullMatch` tinyint(1) NOT NULL DEFAULT '0',
  `dirtyStatus` char(1) NOT NULL,
  `clipboard` varchar(1000) DEFAULT NULL,
  `relationshipId` int(10) unsigned DEFAULT NULL,
  `parentName` varchar(45) DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `checksum` (`shopId`,`checksum`),
  KEY `fk_DirtyProduct_ShopHasProduct1_idx` (`productId`,`productVariantId`,`shopId`),
  KEY `fk_DirtyProduct_DirtyProduct1_idx` (`relationshipId`),
  CONSTRAINT `fk_DirtyProduct_DirtyProduct1` FOREIGN KEY (`relationshipId`) REFERENCES `DirtyProduct` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_DirtyProduct_ShopHasProduct1` FOREIGN KEY (`productId`, `productVariantId`, `shopId`) REFERENCES `ShopHasProduct` (`productId`, `productVariantId`, `shopId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_dirtyProduct_shop` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DirtyProductExtend
CREATE TABLE IF NOT EXISTS `DirtyProductExtend` (
  `dirtyProductId` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shopId` int(10) unsigned NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `season` varchar(45) DEFAULT NULL,
  `audience` varchar(45) DEFAULT NULL,
  `cat1` varchar(45) DEFAULT NULL,
  `cat2` varchar(45) DEFAULT NULL,
  `cat3` varchar(45) DEFAULT NULL,
  `cat4` varchar(45) DEFAULT NULL,
  `cat5` varchar(45) DEFAULT NULL,
  `tag1` varchar(45) DEFAULT NULL,
  `tag2` varchar(45) DEFAULT NULL,
  `tag3` varchar(45) DEFAULT NULL,
  `generalColor` varchar(45) DEFAULT NULL,
  `colorDescription` varchar(45) DEFAULT NULL,
  `sizeGroup` varchar(45) DEFAULT NULL,
  `checksum` char(32) DEFAULT NULL,
  KEY `fk_dirtyProduct_idx` (`dirtyProductId`,`shopId`),
  CONSTRAINT `fk_dirtyProduct` FOREIGN KEY (`dirtyProductId`) REFERENCES `DirtyProduct` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella DirtySku
CREATE TABLE IF NOT EXISTS `DirtySku` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `size` varchar(45) NOT NULL,
  `extSizeId` varchar(45) DEFAULT NULL,
  `extSkuId` varchar(45) DEFAULT NULL,
  `shopId` int(10) unsigned DEFAULT NULL,
  `productSizeId` int(10) unsigned DEFAULT NULL,
  `dirtyProductId` int(10) unsigned DEFAULT NULL,
  `value` double DEFAULT NULL,
  `price` double DEFAULT NULL,
  `salePrice` double DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `changed` tinyint(1) NOT NULL DEFAULT '1',
  `barcode` varchar(30) DEFAULT NULL,
  `text` text,
  `checksum` char(32) DEFAULT NULL,
  `status` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`size`),
  UNIQUE KEY `checksum_UNIQUE` (`checksum`),
  KEY `fk_DirtySku_DirtyProduct1_idx` (`dirtyProductId`),
  KEY `fk_DirtySku_ProductSize1_idx` (`productSizeId`),
  KEY `fk_DirtySku_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_DirtySku_DirtyProduct1` FOREIGN KEY (`dirtyProductId`) REFERENCES `DirtyProduct` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_DirtySku_ProductSize1` FOREIGN KEY (`productSizeId`) REFERENCES `ProductSize` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_DirtySku_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EBayApp
CREATE TABLE IF NOT EXISTS `EBayApp` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `devid` varchar(37) NOT NULL,
  `appid` varchar(37) NOT NULL,
  `certid` varchar(37) NOT NULL,
  `eBaySiteIdDefault` int(10) unsigned NOT NULL,
  `errorLanguage` varchar(255) NOT NULL,
  `warningLevel` varchar(255) NOT NULL,
  `schema` varchar(255) NOT NULL,
  `endpoint` varchar(255) NOT NULL,
  `version` int(10) unsigned NOT NULL,
  `env` char(1) NOT NULL,
  `ruName` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `10_idx` (`eBaySiteIdDefault`),
  CONSTRAINT `10` FOREIGN KEY (`eBaySiteIdDefault`) REFERENCES `EBaySite` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EBaySite
CREATE TABLE IF NOT EXISTS `EBaySite` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `countryId` int(10) unsigned NOT NULL,
  `currencyId` int(10) NOT NULL,
  `ebayCountryId` int(3) unsigned NOT NULL,
  `ebayCountryCode` varchar(4) NOT NULL,
  `ebayCountrySite` varchar(255) NOT NULL,
  `priceModifierPercentage` int(3) NOT NULL,
  `applyVat` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ebayId_UNIQUE` (`ebayCountryId`),
  KEY `5_idx` (`countryId`),
  KEY `8_idx` (`currencyId`),
  CONSTRAINT `5` FOREIGN KEY (`countryId`) REFERENCES `Country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EBayUser
CREATE TABLE IF NOT EXISTS `EBayUser` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `token` varchar(900) NOT NULL,
  `sessionId` varchar(900) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EBayUserHasEBaySite
CREATE TABLE IF NOT EXISTS `EBayUserHasEBaySite` (
  `EBayUserId` int(10) unsigned NOT NULL,
  `EBaySiteId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`EBayUserId`,`EBaySiteId`),
  KEY `9_idx` (`EBaySiteId`),
  KEY `4_idx` (`EBayUserId`),
  CONSTRAINT `4` FOREIGN KEY (`EBayUserId`) REFERENCES `EBayUser` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `9` FOREIGN KEY (`EBaySiteId`) REFERENCES `EBaySite` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EMail
CREATE TABLE IF NOT EXISTS `EMail` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `eMailSenderId` int(11) NOT NULL,
  `subject` varchar(255) DEFAULT NULL,
  `to` varchar(255) DEFAULT NULL,
  `cc` varchar(255) DEFAULT NULL,
  `bcc` varchar(255) DEFAULT NULL,
  `html` tinyint(1) DEFAULT '1',
  `body` text,
  `altBody` text,
  `isReady` tinyint(1) NOT NULL DEFAULT '0',
  `isSend` tinyint(1) NOT NULL DEFAULT '0',
  `isError` tinyint(1) NOT NULL DEFAULT '0',
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `sendDate` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `eMailSender_idx` (`eMailSenderId`),
  CONSTRAINT `eMailSender` FOREIGN KEY (`eMailSenderId`) REFERENCES `EMailSender` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EMailSender
CREATE TABLE IF NOT EXISTS `EMailSender` (
  `id` int(11) NOT NULL,
  `name` varchar(100) NOT NULL,
  `host` varchar(100) NOT NULL,
  `smtpAuth` tinyint(1) NOT NULL DEFAULT '1',
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL,
  `smtpSecure` varchar(3) NOT NULL DEFAULT 'TLS',
  `port` int(11) NOT NULL DEFAULT '584',
  `from` varchar(100) DEFAULT NULL,
  `fromName` varchar(100) DEFAULT NULL,
  `active` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Event
CREATE TABLE IF NOT EXISTS `Event` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `stopped` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EventHasListener
CREATE TABLE IF NOT EXISTS `EventHasListener` (
  `eventId` int(10) unsigned NOT NULL,
  `listenerId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`eventId`,`listenerId`),
  KEY `fk_Event_has_Listener_Listener1_idx` (`listenerId`),
  KEY `fk_Event_has_Listener_Event1_idx` (`eventId`),
  CONSTRAINT `fk_Event_has_Listener_Event1` FOREIGN KEY (`eventId`) REFERENCES `Event` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Event_has_Listener_Listener1` FOREIGN KEY (`listenerId`) REFERENCES `EventListener` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella EventListener
CREATE TABLE IF NOT EXISTS `EventListener` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `classToInvoke` varchar(45) NOT NULL,
  `stopped` tinyint(1) NOT NULL DEFAULT '0',
  `isAsync` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ExceptionLog
CREATE TABLE IF NOT EXISTS `ExceptionLog` (
  `id` int(10) NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `userId` int(10) DEFAULT NULL,
  `exception` longtext NOT NULL,
  PRIMARY KEY (`id`,`creationDate`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella FixedPage
CREATE TABLE IF NOT EXISTS `FixedPage` (
  `id` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `fixedPageTypeId` int(10) unsigned NOT NULL,
  `title` varchar(255) DEFAULT NULL,
  `subtitle` varchar(255) DEFAULT NULL,
  `slug` varchar(255) DEFAULT NULL,
  `text` longtext,
  `mainImage` varchar(255) DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `lastUpdate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`,`langId`,`fixedPageTypeId`),
  KEY `fk_FixedPage_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_FixedPage_FixedPageType1_idx` (`fixedPageTypeId`),
  CONSTRAINT `fk_FixedPage_FixedPageType1` FOREIGN KEY (`fixedPageTypeId`) REFERENCES `FixedPageType` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_FixedPage_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella FixedPageType
CREATE TABLE IF NOT EXISTS `FixedPageType` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterConnector
CREATE TABLE IF NOT EXISTS `ImporterConnector` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shopId` int(10) unsigned NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `scope` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_ImporterConnector_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_ImporterConnector_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterConnectorOperation
CREATE TABLE IF NOT EXISTS `ImporterConnectorOperation` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `importerFieldModifierId` int(10) unsigned DEFAULT NULL,
  `importerFieldId` int(10) unsigned NOT NULL,
  `importerOperatorId` int(10) unsigned NOT NULL,
  `value` varchar(45) NOT NULL,
  `importerLogicConnectorId` int(10) unsigned DEFAULT NULL,
  `nextOperationId` int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_ImporterConnectorOperation_ImporterConnectorOperation_idx` (`nextOperationId`),
  KEY `fk_ImporterField_idx` (`importerFieldId`),
  KEY `fk_ImporterConnectorOperation_ImporterFieldModifier1_idx` (`importerFieldModifierId`),
  KEY `fk_ImporterConnectorOperation_ImporterLogicConnector1_idx` (`importerLogicConnectorId`),
  CONSTRAINT `fk_ImporterConnectorOperation_ImporterConnectorOperation` FOREIGN KEY (`nextOperationId`) REFERENCES `ImporterConnectorOperation` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ImporterConnectorOperation_ImporterFieldModifier1` FOREIGN KEY (`importerFieldModifierId`) REFERENCES `ImporterFieldModifier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ImporterConnectorOperation_ImporterLogicConnector1` FOREIGN KEY (`importerLogicConnectorId`) REFERENCES `ImporterLogicConnector` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ImporterField` FOREIGN KEY (`importerFieldId`) REFERENCES `ImporterField` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterConnectorStart
CREATE TABLE IF NOT EXISTS `ImporterConnectorStart` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `importerConnectorId` int(10) unsigned NOT NULL,
  `value` varchar(45) NOT NULL,
  `priority` tinyint(4) NOT NULL DEFAULT '100',
  `importerConnectorOperationId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_ImporterConnectorStart_ImporterConnector1_idx1` (`importerConnectorId`),
  KEY `fk_ImporterConnectorStart_ImporterConnectorOperation1_idx1` (`importerConnectorOperationId`),
  CONSTRAINT `fk_ImporterConnectorStart_ImporterConnector1` FOREIGN KEY (`importerConnectorId`) REFERENCES `ImporterConnector` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ImporterConnectorStart_ImporterConnectorOperation1` FOREIGN KEY (`importerConnectorOperationId`) REFERENCES `ImporterConnectorOperation` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterField
CREATE TABLE IF NOT EXISTS `ImporterField` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `location` varchar(45) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterFieldModifier
CREATE TABLE IF NOT EXISTS `ImporterFieldModifier` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `modifier` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterLogicConnector
CREATE TABLE IF NOT EXISTS `ImporterLogicConnector` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImporterOperator
CREATE TABLE IF NOT EXISTS `ImporterOperator` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ImportItemsReview
CREATE TABLE IF NOT EXISTS `ImportItemsReview` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `shopId` int(10) unsigned NOT NULL DEFAULT '0',
  `jobId` int(10) unsigned DEFAULT '0',
  `jobExecutionId` int(10) unsigned DEFAULT '0',
  `action` varchar(5) NOT NULL DEFAULT '0',
  `object` varchar(10) DEFAULT '0',
  `fileType` varchar(5) NOT NULL,
  `file` int(10) unsigned DEFAULT '0',
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci COMMENT='Table to store the item with problem in the standard importer';

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Invoice
CREATE TABLE IF NOT EXISTS `Invoice` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderId` int(10) unsigned zerofill NOT NULL,
  `invoiceYear` year(4) NOT NULL,
  `invoiceType` char(1) NOT NULL DEFAULT 'F',
  `invoiceSiteChar` char(1) NOT NULL DEFAULT 'P',
  `invoiceNumber` int(6) unsigned NOT NULL,
  `invoiceDate` datetime NOT NULL,
  `invoiceText` text,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_invoice` (`invoiceYear`,`invoiceNumber`,`invoiceType`,`invoiceSiteChar`),
  KEY `fk_orderId_idx` (`orderId`),
  CONSTRAINT `fk_order_id` FOREIGN KEY (`orderId`) REFERENCES `Order` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Job
CREATE TABLE IF NOT EXISTS `Job` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `protocol` varchar(45) NOT NULL DEFAULT 'curl',
  `host` varchar(255) NOT NULL DEFAULT 'com',
  `command` varchar(255) NOT NULL,
  `defaultArgs` varchar(255) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT '0',
  `isRunning` tinyint(1) NOT NULL DEFAULT '0',
  `manualStart` tinyint(1) NOT NULL DEFAULT '0',
  `manualKill` tinyint(1) NOT NULL DEFAULT '0',
  `secondsToLive` int(11) NOT NULL DEFAULT '600',
  `username` varchar(45) DEFAULT NULL,
  `password` varchar(45) DEFAULT NULL,
  `minute` varchar(45) DEFAULT '*',
  `hour` varchar(45) DEFAULT '*',
  `mday` varchar(45) DEFAULT '*',
  `month` varchar(45) DEFAULT '*',
  `wday` varchar(45) DEFAULT '*',
  `logFile` varchar(255) DEFAULT NULL,
  `notificationSetup` varchar(45) DEFAULT NULL,
  `notificationEmail` varchar(255) DEFAULT NULL,
  `lastExecution` timestamp NULL DEFAULT NULL,
  `lastUpdate` timestamp NULL DEFAULT NULL,
  `isDebug` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella JobExecution
CREATE TABLE IF NOT EXISTS `JobExecution` (
  `id` int(11) NOT NULL,
  `jobId` int(11) NOT NULL,
  `threadId` varchar(45) NOT NULL,
  `status` varchar(45) DEFAULT NULL,
  `start` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `args` varchar(255) DEFAULT NULL,
  `end` timestamp NULL DEFAULT NULL,
  `exitValue` varchar(45) DEFAULT NULL,
  `error` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`jobId`),
  KEY `jobId_idx` (`jobId`),
  CONSTRAINT `jobId` FOREIGN KEY (`jobId`) REFERENCES `Job` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella JobLog
CREATE TABLE IF NOT EXISTS `JobLog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `jobId` int(11) NOT NULL,
  `jobExecutionId` int(11) NOT NULL,
  `severity` varchar(10) NOT NULL DEFAULT 'REPORT',
  `subject` varchar(45) NOT NULL,
  `content` varchar(255) NOT NULL,
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `context` text,
  `manualKill` tinyint(4) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`jobId`,`jobExecutionId`),
  KEY `jobId_idx` (`jobId`,`jobExecutionId`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Lang
CREATE TABLE IF NOT EXISTS `Lang` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `lang` varchar(2) NOT NULL,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `lang_UNIQUE` (`lang`),
  UNIQUE KEY `name_UNIQUE` (`name`),
  KEY `lang` (`lang`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Locale
CREATE TABLE IF NOT EXISTS `Locale` (
  `langId` int(10) unsigned NOT NULL,
  `currencyId` int(10) unsigned NOT NULL,
  `countryId` int(10) unsigned NOT NULL,
  `dateFormat` varchar(255) NOT NULL,
  `numberFormat` varchar(255) NOT NULL,
  PRIMARY KEY (`langId`,`currencyId`,`countryId`),
  KEY `13_idx` (`currencyId`),
  KEY `14_idx` (`countryId`),
  CONSTRAINT `13` FOREIGN KEY (`currencyId`) REFERENCES `Currency` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `14` FOREIGN KEY (`countryId`) REFERENCES `Country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `7` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Marketplace
CREATE TABLE IF NOT EXISTS `Marketplace` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Newsletter
CREATE TABLE IF NOT EXISTS `Newsletter` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(45) NOT NULL DEFAULT '0',
  `isActive` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Order
CREATE TABLE IF NOT EXISTS `Order` (
  `id` int(10) unsigned zerofill NOT NULL AUTO_INCREMENT,
  `orderPaymentMethodId` int(10) unsigned DEFAULT NULL,
  `orderShippingMethodId` int(10) unsigned DEFAULT NULL,
  `couponId` int(10) unsigned DEFAULT NULL,
  `userId` int(10) unsigned DEFAULT NULL,
  `status` varchar(15) NOT NULL DEFAULT 'CRT',
  `frozenBillingAddress` blob,
  `frozenShippingAddress` blob,
  `shippingPrice` double unsigned DEFAULT '0',
  `userDiscount` double unsigned DEFAULT '0',
  `couponDiscount` double DEFAULT NULL,
  `paymentModifier` double DEFAULT NULL,
  `grossTotal` double unsigned DEFAULT '0',
  `netTotal` double unsigned DEFAULT NULL,
  `orderDate` timestamp NULL DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `transactionNumber` int(11) DEFAULT NULL,
  `transactionMac` varchar(45) DEFAULT NULL,
  `paidAmount` double DEFAULT NULL,
  `paymentDate` timestamp NULL DEFAULT NULL,
  `lastUpdate` timestamp NULL DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_Order_OrderPaymentMethod1_idx` (`orderPaymentMethodId`),
  KEY `fk_Order_Coupon1_idx` (`couponId`),
  KEY `fk_Order_User1_idx` (`userId`),
  KEY `21_idx` (`orderShippingMethodId`),
  CONSTRAINT `21` FOREIGN KEY (`orderShippingMethodId`) REFERENCES `OrderShippingMethod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Order_Coupon1` FOREIGN KEY (`couponId`) REFERENCES `Coupon` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Order_OrderPaymentMethod1` FOREIGN KEY (`orderPaymentMethodId`) REFERENCES `OrderPaymentMethod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderAutomaticHistry
CREATE TABLE IF NOT EXISTS `OrderAutomaticHistry` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderId` int(10) unsigned NOT NULL,
  `query` varchar(455) DEFAULT NULL,
  `data` varchar(445) DEFAULT NULL,
  `oldStatus` varchar(20) DEFAULT NULL,
  `newStatus` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`,`orderId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderHistory
CREATE TABLE IF NOT EXISTS `OrderHistory` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderId` int(10) unsigned zerofill NOT NULL,
  `event` varchar(45) NOT NULL,
  `description` varchar(255) NOT NULL,
  `status` varchar(45) NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_OrderHistory_Order1_idx` (`orderId`),
  CONSTRAINT `fk_OrderHistory_Order1` FOREIGN KEY (`orderId`) REFERENCES `Order` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderLine
CREATE TABLE IF NOT EXISTS `OrderLine` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderId` int(10) unsigned NOT NULL DEFAULT '0',
  `productId` int(10) unsigned NOT NULL DEFAULT '0',
  `productVariantId` int(10) unsigned NOT NULL DEFAULT '0',
  `productSizeId` int(10) unsigned NOT NULL DEFAULT '0',
  `shopId` int(10) unsigned NOT NULL DEFAULT '0',
  `status` varchar(15) NOT NULL DEFAULT 'CRT',
  `frozenProduct` blob,
  `fullPrice` double DEFAULT NULL,
  `activePrice` double DEFAULT NULL,
  `cost` double DEFAULT NULL,
  `shippingCharge` double DEFAULT NULL,
  `couponCharge` double DEFAULT NULL,
  `userCharge` double DEFAULT NULL,
  `paymentCharge` double DEFAULT NULL,
  `netPrice` double DEFAULT NULL,
  `friendRevenue` double DEFAULT NULL,
  `acceptanceDate` timestamp NULL DEFAULT NULL,
  `friendAcceptanceDate` timestamp NULL DEFAULT NULL,
  `shipmentBookingDate` timestamp NULL DEFAULT NULL,
  `arrivalDate` timestamp NULL DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `lastUpdate` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`,`orderId`),
  KEY `fk_OrderLine_Order1_idx1231235676` (`orderId`),
  KEY `fk_OrderLine_ProductSku1_idx151251756474` (`productId`,`productVariantId`,`productSizeId`,`shopId`),
  CONSTRAINT `fk_OrderLine_Order115215` FOREIGN KEY (`orderId`) REFERENCES `Order` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_OrderLine_ProductSku11241212` FOREIGN KEY (`productId`, `productVariantId`, `productSizeId`, `shopId`) REFERENCES `ProductSku` (`productId`, `productVariantId`, `productSizeId`, `shopId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderLineHasShipment
CREATE TABLE IF NOT EXISTS `OrderLineHasShipment` (
  `orderLineId` int(10) unsigned NOT NULL,
  `orderId` int(10) unsigned NOT NULL,
  `shipmentId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`orderLineId`,`orderId`,`shipmentId`),
  KEY `fk_OrderLine_has_Shipment_Shipment1_idx` (`shipmentId`),
  KEY `fk_OrderLine_has_Shipment_OrderLine1_idx` (`orderLineId`,`orderId`),
  CONSTRAINT `fk_OrderLine_has_Shipment_OrderLine1` FOREIGN KEY (`orderLineId`, `orderId`) REFERENCES `OrderLine` (`id`, `orderId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_OrderLine_has_Shipment_Shipment1` FOREIGN KEY (`shipmentId`) REFERENCES `Shipment` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderLineStatus
CREATE TABLE IF NOT EXISTS `OrderLineStatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(15) NOT NULL,
  `title` varchar(45) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `nextOrderLineStatusId` int(11) DEFAULT NULL,
  `errOrderLineStatusId` int(11) DEFAULT NULL,
  `phase` tinyint(4) DEFAULT NULL,
  `isManageable` tinyint(1) DEFAULT NULL,
  `colore` varchar(10) DEFAULT NULL,
  `notify` smallint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_UNIQUE` (`code`),
  KEY `fk_OrderLineStatus_OrderLineStatus1_idx` (`errOrderLineStatusId`),
  KEY `fk_OrderLineStatus_OrderLineStatus2_idx` (`nextOrderLineStatusId`),
  CONSTRAINT `fk_OrderLineStatus_OrderLineStatus1` FOREIGN KEY (`errOrderLineStatusId`) REFERENCES `OrderLineStatus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_OrderLineStatus_OrderLineStatus2` FOREIGN KEY (`nextOrderLineStatusId`) REFERENCES `OrderLineStatus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderPaymentMethod
CREATE TABLE IF NOT EXISTS `OrderPaymentMethod` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `isActive` tinyint(1) NOT NULL,
  `modifier` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderPaymentMethodTranslation
CREATE TABLE IF NOT EXISTS `OrderPaymentMethodTranslation` (
  `orderPaymentMethodId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  PRIMARY KEY (`orderPaymentMethodId`,`langId`),
  KEY `fk_OrderPaymentMethodTranslation_Lang1_idx` (`langId`),
  CONSTRAINT `fk_OrderPaymentMethodTranslation_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_OrderPaymentMethodTranslation_OrderPaymentMethod1` FOREIGN KEY (`orderPaymentMethodId`) REFERENCES `OrderPaymentMethod` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderStatus
CREATE TABLE IF NOT EXISTS `OrderStatus` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `code` varchar(15) NOT NULL,
  `title` varchar(45) NOT NULL,
  `description` varchar(100) DEFAULT NULL,
  `nextOrderStatusId` int(11) DEFAULT NULL,
  `errOrderStatusId` int(11) DEFAULT NULL,
  `order` tinyint(4) DEFAULT NULL,
  `color` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_UNIQUE` (`code`),
  KEY `fk_OrderStatus_OrderStatus2_idx` (`nextOrderStatusId`),
  KEY `fk_OrderStatus_OrderStatus1_idx` (`errOrderStatusId`),
  CONSTRAINT `fk_OrderStatus_OrderStatus1` FOREIGN KEY (`errOrderStatusId`) REFERENCES `OrderStatus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_OrderStatus_OrderStatus2` FOREIGN KEY (`nextOrderStatusId`) REFERENCES `OrderStatus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderStatusHasLang
CREATE TABLE IF NOT EXISTS `OrderStatusHasLang` (
  `orderStatusId` int(11) NOT NULL DEFAULT '0',
  `langId` int(10) unsigned NOT NULL DEFAULT '0',
  `title` varchar(45) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`orderStatusId`,`langId`),
  KEY `fk_OrderStatus_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_OrderStatus_has_Lang_OrderStatus1_idx` (`orderStatusId`),
  CONSTRAINT `OrderStatusHasLang_ibfk_1` FOREIGN KEY (`orderStatusId`) REFERENCES `OrderStatus` (`id`),
  CONSTRAINT `OrderStatusHasLang_ibfk_2` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella OrderStatusTranslation
CREATE TABLE IF NOT EXISTS `OrderStatusTranslation` (
  `orderStatusId` int(11) NOT NULL DEFAULT '0',
  `langId` int(10) unsigned NOT NULL DEFAULT '0',
  `title` varchar(45) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`orderStatusId`,`langId`),
  KEY `fk_OrderStatusTranslation_Lang1_idx` (`langId`),
  KEY `fk_OrderStatusTranslation_OrderStatus1_idx` (`orderStatusId`),
  CONSTRAINT `OrderStatusTranslation_ibfk_1` FOREIGN KEY (`orderStatusId`) REFERENCES `OrderStatus` (`id`),
  CONSTRAINT `OrderStatusTranslation_ibfk_2` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Page
CREATE TABLE IF NOT EXISTS `Page` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL,
  `url` varchar(255) NOT NULL,
  `icon` varchar(45) NOT NULL,
  `permission` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PageTranslation
CREATE TABLE IF NOT EXISTS `PageTranslation` (
  `pageId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `description` varchar(300) DEFAULT NULL,
  `keywords` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`pageId`,`langId`),
  KEY `fk_Page_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_Page_has_Lang_Page1_idx` (`pageId`)
) ENGINE=InnoDb DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Post
CREATE TABLE IF NOT EXISTS `Post` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `blogId` int(10) unsigned NOT NULL,
  `userId` int(10) unsigned NOT NULL,
  `postStatusId` int(10) unsigned NOT NULL,
  `creationDate` datetime NOT NULL,
  `publishDate` datetime NOT NULL,
  `author` varchar(255) NOT NULL,
  `hits` int(10) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`,`blogId`),
  KEY `fk_Post_Blog1_idx` (`blogId`),
  KEY `fk_Post_User1_idx` (`userId`),
  KEY `fk_Post_PostStatus1_idx` (`postStatusId`),
  CONSTRAINT `fk_Post_Blog1` FOREIGN KEY (`blogId`) REFERENCES `Blog` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Post_PostStatus1` FOREIGN KEY (`postStatusId`) REFERENCES `PostStatus` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Post_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostCategory
CREATE TABLE IF NOT EXISTS `PostCategory` (
  `id` int(10) unsigned NOT NULL,
  `parentPostCategoryId` int(10) unsigned DEFAULT NULL,
  `slug` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_PostCategory_PostCategory1_idx` (`parentPostCategoryId`),
  CONSTRAINT `fk_PostCategory_PostCategory1` FOREIGN KEY (`parentPostCategoryId`) REFERENCES `PostCategory` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostCategoryTranslation
CREATE TABLE IF NOT EXISTS `PostCategoryTranslation` (
  `postCategoryId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`postCategoryId`,`langId`),
  KEY `fk_PostCategory_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_PostCategory_has_Lang_PostCategory1_idx` (`postCategoryId`),
  CONSTRAINT `fk_PostCategory_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_PostCategory_has_Lang_PostCategory1` FOREIGN KEY (`postCategoryId`) REFERENCES `PostCategory` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostHasPostCategory
CREATE TABLE IF NOT EXISTS `PostHasPostCategory` (
  `postId` int(10) unsigned NOT NULL,
  `postBlogId` int(10) unsigned NOT NULL,
  `postCategoryId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`postId`,`postBlogId`,`postCategoryId`),
  KEY `fk_Post_has_PostCategory_PostCategory1_idx` (`postCategoryId`),
  KEY `fk_Post_has_PostCategory_Post1_idx` (`postId`,`postBlogId`),
  CONSTRAINT `fk_Post_has_PostCategory_Post1` FOREIGN KEY (`postId`, `postBlogId`) REFERENCES `Post` (`id`, `blogId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Post_has_PostCategory_PostCategory1` FOREIGN KEY (`postCategoryId`) REFERENCES `PostCategory` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostHasPostTag
CREATE TABLE IF NOT EXISTS `PostHasPostTag` (
  `postId` int(10) unsigned NOT NULL,
  `postBlogId` int(10) unsigned NOT NULL,
  `postTagId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`postId`,`postBlogId`,`postTagId`),
  KEY `fk_Post_has_PostTag_PostTag1_idx` (`postTagId`),
  KEY `fk_Post_has_PostTag_Post1_idx` (`postId`,`postBlogId`),
  CONSTRAINT `fk_Post_has_PostTag_Post1` FOREIGN KEY (`postId`, `postBlogId`) REFERENCES `Post` (`id`, `blogId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Post_has_PostTag_PostTag1` FOREIGN KEY (`postTagId`) REFERENCES `PostTag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostStatus
CREATE TABLE IF NOT EXISTS `PostStatus` (
  `id` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `show` tinyint(4) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostTag
CREATE TABLE IF NOT EXISTS `PostTag` (
  `id` int(10) unsigned NOT NULL,
  `slug` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostTagTranslation
CREATE TABLE IF NOT EXISTS `PostTagTranslation` (
  `postTagId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`postTagId`,`langId`),
  KEY `fk_PostTag_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_PostTag_has_Lang_PostTag1_idx` (`postTagId`),
  CONSTRAINT `fk_PostTag_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_PostTag_has_Lang_PostTag1` FOREIGN KEY (`postTagId`) REFERENCES `PostTag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella PostTranslation
CREATE TABLE IF NOT EXISTS `PostTranslation` (
  `postId` int(10) unsigned NOT NULL,
  `blogId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  `subtitle` longtext NOT NULL,
  `content` longtext NOT NULL,
  `coverImage` varchar(255) NOT NULL,
  PRIMARY KEY (`postId`,`blogId`,`langId`),
  KEY `fk_Post_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_Post_has_Lang_Post1_idx` (`postId`,`blogId`),
  CONSTRAINT `fk_Post_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Post_has_Lang_Post1` FOREIGN KEY (`postId`, `blogId`) REFERENCES `Post` (`id`, `blogId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di procedura pProductCategoryDepthUpdate
DELIMITER //
//
DELIMITER ;

-- Dump della struttura di tabella Product
CREATE TABLE IF NOT EXISTS `Product` (
  `id` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `itemno` varchar(32) NOT NULL,
  `creationDate` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `dummyPicture` varchar(100) DEFAULT NULL,
  `productSeasonId` int(10) unsigned DEFAULT NULL,
  `productBrandId` int(10) unsigned NOT NULL,
  `sortingPriorityId` int(10) unsigned NOT NULL DEFAULT '99',
  `productSizeGroupId` int(10) unsigned DEFAULT NULL,
  `sizeGroupId` int(11) DEFAULT NULL,
  `productStatusId` int(10) unsigned NOT NULL DEFAULT '2',
  `productSheetPrototypeId` int(10) unsigned DEFAULT NULL,
  `externalId` varchar(45) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `sheetName` varchar(45) DEFAULT NULL,
  `lastUpdate` datetime DEFAULT NULL,
  `status` char(1) NOT NULL DEFAULT 'D',
  PRIMARY KEY (`id`,`productVariantId`),
  KEY `itemno` (`itemno`),
  KEY `fk_product_productSeason1_idx` (`productSeasonId`),
  KEY `fk_product_productColor1_idx` (`productVariantId`),
  KEY `fk_Product_Brand1_idx` (`productBrandId`),
  KEY `fk_Product_SortingPriority1_idx` (`sortingPriorityId`),
  KEY `fk_product_productStatus` (`status`),
  KEY `fk_product_productSheetPrototype_idx` (`productSheetPrototypeId`),
  KEY `fk_product_productStatusId_idx` (`productStatusId`),
  KEY `fk_product_productSizeGroup_idx` (`productSizeGroupId`),
  CONSTRAINT `fk_Product_Brand1` FOREIGN KEY (`productBrandId`) REFERENCES `ProductBrand` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Product_SortingPriority1` FOREIGN KEY (`sortingPriorityId`) REFERENCES `SortingPriority` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_product_productColor1` FOREIGN KEY (`productVariantId`) REFERENCES `ProductVariant` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_product_productSeason1` FOREIGN KEY (`productSeasonId`) REFERENCES `ProductSeason` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_product_productSheetPrototype` FOREIGN KEY (`productSheetPrototypeId`) REFERENCES `ProductSheetPrototype` (`id`),
  CONSTRAINT `fk_product_productSizeGroup` FOREIGN KEY (`productSizeGroupId`) REFERENCES `ProductSizeGroup` (`id`),
  CONSTRAINT `fk_product_productStatusId` FOREIGN KEY (`productStatusId`) REFERENCES `ProductStatus` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductAttribute
CREATE TABLE IF NOT EXISTS `ProductAttribute` (
  `id` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `order` int(11) NOT NULL DEFAULT '99',
  PRIMARY KEY (`id`,`langId`),
  KEY `fk_ProductAttribute_Lang1_idx` (`langId`),
  CONSTRAINT `fk_ProductAttribute_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductAttributeValue
CREATE TABLE IF NOT EXISTS `ProductAttributeValue` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `productAttributeId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`,`productAttributeId`,`langId`),
  KEY `fk_productAttribute_idx` (`productAttributeId`,`langId`,`name`),
  CONSTRAINT `fk_productAttribute` FOREIGN KEY (`productAttributeId`, `langId`) REFERENCES `ProductAttribute` (`id`, `langId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductBrand
CREATE TABLE IF NOT EXISTS `ProductBrand` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(100) NOT NULL,
  `name` varchar(100) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `name_UNIQUE` (`name`),
  UNIQUE KEY `ProductBrand_slug_uindex` (`slug`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductCatalogFilter
CREATE TABLE IF NOT EXISTS `ProductCatalogFilter` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `langId` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `oohtoriqwht0yq486t7345buy2b4321` (`langId`),
  CONSTRAINT `fk_productSubtype_lang1agdasrgbvfaygrftauegbfeger` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductCategory
CREATE TABLE IF NOT EXISTS `ProductCategory` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) COLLATE utf8_bin NOT NULL,
  `lft` int(10) unsigned NOT NULL,
  `rght` int(10) NOT NULL,
  `depth` int(3) unsigned DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `lft` (`lft`) USING BTREE,
  KEY `rgt` (`rght`) USING BTREE
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci COLLATE=utf8_bin;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductCategoryHasProductCatalogFilter
CREATE TABLE IF NOT EXISTS `ProductCategoryHasProductCatalogFilter` (
  `productCategoryId` int(10) unsigned NOT NULL,
  `productCatalogFilterId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productCategoryId`,`productCatalogFilterId`),
  KEY `fk_ProductCategory_has_ProductCatalogFilter_ProductCatalogF_idx` (`productCatalogFilterId`),
  KEY `fk_ProductCategory_has_ProductCatalogFilter_ProductCategory_idx` (`productCategoryId`),
  CONSTRAINT `fk_ProductCategory_has_ProductCatalogFilter_ProductCatalogFil1` FOREIGN KEY (`productCatalogFilterId`) REFERENCES `ProductCatalogFilter` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductCategory_has_ProductCatalogFilter_ProductCategory1` FOREIGN KEY (`productCategoryId`) REFERENCES `ProductCategory` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductCategoryMarketPlaceLookup
CREATE TABLE IF NOT EXISTS `ProductCategoryMarketPlaceLookup` (
  `productCategoryId` int(11) NOT NULL,
  `marketPlaceId` int(11) NOT NULL,
  `marketPlaceCategoryId` int(11) NOT NULL,
  `marketPlaceCategoryName` varchar(50) DEFAULT NULL,
  `marketPlaceCategoryPath` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`productCategoryId`,`marketPlaceId`,`marketPlaceCategoryId`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductCategoryTranslation
CREATE TABLE IF NOT EXISTS `ProductCategoryTranslation` (
  `productCategoryId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  `description` text,
  PRIMARY KEY (`productCategoryId`,`langId`),
  KEY `fk_ProductCategory_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_ProductCategory_has_Lang_ProductCategory1_idx` (`productCategoryId`),
  CONSTRAINT `fk_ProductCategory_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductCategory_has_Lang_ProductCategory1PADREPIO` FOREIGN KEY (`productCategoryId`) REFERENCES `ProductCategory` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductColorGroup
CREATE TABLE IF NOT EXISTS `ProductColorGroup` (
  `id` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `slug` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `hex` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`,`langId`),
  KEY `fk_productColor_lang1_idx` (`langId`),
  CONSTRAINT `fk_productColor_lang10` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDescription
CREATE TABLE IF NOT EXISTS `ProductDescription` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `marketplaceId` int(10) unsigned NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`langId`,`marketplaceId`),
  KEY `fk_ProductName_Product1_idx` (`productId`,`productVariantId`),
  KEY `fk_ProductName_Lang1_idx` (`langId`),
  KEY `fk_ProductDescription_Marketplace1_idx` (`marketplaceId`),
  CONSTRAINT `fk_ProductDescription_Marketplace1` FOREIGN KEY (`marketplaceId`) REFERENCES `Marketplace` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductName_Lang10` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductName_Product10` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDescriptionTranslation
CREATE TABLE IF NOT EXISTS `ProductDescriptionTranslation` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `marketplaceId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`marketplaceId`,`langId`),
  KEY `fk_ProductName_Product1111_idx` (`productId`,`productVariantId`),
  KEY `fk_ProductDescription_Marketplace1111_idx` (`marketplaceId`),
  KEY `10_idx` (`langId`),
  CONSTRAINT `10111111` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductDescription_Marketplace1111` FOREIGN KEY (`marketplaceId`) REFERENCES `Marketplace` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductName_Product1111` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDetail
CREATE TABLE IF NOT EXISTS `ProductDetail` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDetailLabel
CREATE TABLE IF NOT EXISTS `ProductDetailLabel` (
  `id` int(10) unsigned NOT NULL,
  `slug` varchar(45) NOT NULL,
  `order` int(11) NOT NULL DEFAULT '99',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDetailLabelTranslation
CREATE TABLE IF NOT EXISTS `ProductDetailLabelTranslation` (
  `productDetailLabelId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`productDetailLabelId`,`langId`),
  KEY `5456456456456_idx` (`langId`),
  KEY `645645645645_idx` (`productDetailLabelId`),
  CONSTRAINT `556464564564` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `654645645645` FOREIGN KEY (`productDetailLabelId`) REFERENCES `ProductDetailLabel` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductDetailTranslation
CREATE TABLE IF NOT EXISTS `ProductDetailTranslation` (
  `productDetailId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`productDetailId`,`langId`),
  KEY `254645645645_idx` (`productDetailId`),
  KEY `3654645645645_idx` (`langId`),
  CONSTRAINT `24654645645` FOREIGN KEY (`productDetailId`) REFERENCES `ProductDetail` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `35645645645` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHasProductAttributeValue
CREATE TABLE IF NOT EXISTS `ProductHasProductAttributeValue` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productAttributeValueId` int(10) unsigned NOT NULL,
  `productAttributeId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productAttributeValueId`,`productAttributeId`),
  KEY `fk_productAttributeValue_idx` (`productAttributeValueId`,`productAttributeId`),
  CONSTRAINT `fk_product` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_productAttributeValue` FOREIGN KEY (`productAttributeValueId`, `productAttributeId`) REFERENCES `ProductAttributeValue` (`id`, `productAttributeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHasProductCategory
CREATE TABLE IF NOT EXISTS `ProductHasProductCategory` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productCategoryId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productCategoryId`),
  KEY `fk_Product_has_ProductCategory_ProductCategory1_idx` (`productCategoryId`),
  KEY `fk_Product_has_ProductCategory_Product1_idx` (`productId`,`productVariantId`),
  CONSTRAINT `fk_Product_has_ProductCategory_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Product_has_ProductCategory_ProductCategory1` FOREIGN KEY (`productCategoryId`) REFERENCES `ProductCategory` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHasProductColorGroup
CREATE TABLE IF NOT EXISTS `ProductHasProductColorGroup` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productColorGroupId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productColorGroupId`),
  KEY `fk_Product_has_ProductColorGroup_Product1_idx` (`productId`,`productVariantId`),
  KEY `fk_Product_has_ProductColorGroup_ProductColorGroup1_idx` (`productColorGroupId`),
  CONSTRAINT `fk_Product_has_ProductColorGroup_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Product_has_ProductColorGroup_ProductColorGroup1` FOREIGN KEY (`productColorGroupId`) REFERENCES `ProductColorGroup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHasProductPhoto
CREATE TABLE IF NOT EXISTS `ProductHasProductPhoto` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productPhotoId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productPhotoId`),
  KEY `fk_Product_has_ProductPhoto_ProductPhoto1_idx` (`productPhotoId`),
  KEY `fk_Product_has_ProductPhoto_Product1_idx` (`productId`,`productVariantId`),
  CONSTRAINT `fk_Product_has_ProductPhoto_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Product_has_ProductPhoto_ProductPhoto1` FOREIGN KEY (`productPhotoId`) REFERENCES `ProductPhoto` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHasTag
CREATE TABLE IF NOT EXISTS `ProductHasTag` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `tagId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`tagId`),
  KEY `fk_Product_has_Tag_Tag1_idx` (`tagId`),
  KEY `fk_Product_has_Tag_Product1_idx` (`productId`,`productVariantId`),
  CONSTRAINT `fk_Product_has_Tag_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Product_has_Tag_Tag1` FOREIGN KEY (`tagId`) REFERENCES `Tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductHistory
CREATE TABLE IF NOT EXISTS `ProductHistory` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `userId` int(10) unsigned NOT NULL,
  `action` varchar(255) NOT NULL,
  `description` text,
  PRIMARY KEY (`id`,`productId`,`productVariantId`,`userId`),
  KEY `2_idx` (`userId`),
  KEY `3_idx` (`productId`,`productVariantId`),
  CONSTRAINT `2` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `3` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductName
CREATE TABLE IF NOT EXISTS `ProductName` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`langId`),
  KEY `fk_ProductName_Product1_idx` (`productId`,`productVariantId`),
  KEY `fk_ProductName_Lang1_idx` (`langId`),
  CONSTRAINT `fk_ProductName_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductName_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductNameTranslation
CREATE TABLE IF NOT EXISTS `ProductNameTranslation` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`langId`),
  KEY `fk_ProductName_Product13643645645_idx` (`productId`,`productVariantId`),
  KEY `fk_ProductName_Lang1456456544_idx` (`langId`),
  CONSTRAINT `fk_ProductName_Lang145645645` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductName_Product145654645` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductOld
CREATE TABLE IF NOT EXISTS `ProductOld` (
  `id` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `itemno` varchar(32) NOT NULL,
  `creationDate` datetime NOT NULL,
  `dummyPicture` varchar(100) DEFAULT NULL,
  `productSeasonId` int(10) unsigned DEFAULT NULL,
  `productBrandId` int(10) unsigned NOT NULL,
  `sortingPriorityId` int(10) unsigned NOT NULL DEFAULT '99',
  `productSizeGroupId` int(10) unsigned DEFAULT NULL,
  `productSheetPrototypeId` int(10) unsigned DEFAULT NULL,
  `externalId` varchar(45) DEFAULT NULL,
  `note` varchar(255) DEFAULT NULL,
  `sheetName` varchar(45) DEFAULT NULL,
  `lastUpdate` datetime DEFAULT NULL,
  `status` char(1) NOT NULL DEFAULT 'D',
  PRIMARY KEY (`id`,`productVariantId`),
  KEY `itemno` (`itemno`),
  KEY `fk_product_productSeason1_idx` (`productSeasonId`),
  KEY `fk_product_productColor1_idx` (`productVariantId`),
  KEY `fk_Product_Brand1_idx` (`productBrandId`),
  KEY `fk_Product_SortingPriority1_idx` (`sortingPriorityId`),
  KEY `fk_product_productStatus` (`status`),
  KEY `9_idx` (`productSizeGroupId`),
  KEY `13_idx` (`productSheetPrototypeId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductPhoto
CREATE TABLE IF NOT EXISTS `ProductPhoto` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `size` int(10) unsigned NOT NULL,
  `width` int(10) unsigned DEFAULT NULL,
  `height` int(10) unsigned DEFAULT NULL,
  `dpi` int(10) unsigned NOT NULL DEFAULT '72',
  `name` varchar(255) NOT NULL,
  `mime` varchar(127) DEFAULT NULL,
  `order` int(10) unsigned NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `isPublic` tinyint(1) unsigned DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `isPublic_idx` (`isPublic`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductPhotoStub
CREATE TABLE IF NOT EXISTS `ProductPhotoStub` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `size` int(10) unsigned NOT NULL,
  `width` int(10) unsigned DEFAULT NULL,
  `height` int(10) unsigned DEFAULT NULL,
  `dpi` int(10) unsigned NOT NULL DEFAULT '72',
  `name` varchar(255) NOT NULL,
  `mime` varchar(127) DEFAULT NULL,
  `order` int(10) unsigned NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `isPublic` tinyint(1) unsigned DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSaleCount
CREATE TABLE IF NOT EXISTS `ProductSaleCount` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productSizeId` int(10) unsigned NOT NULL,
  `shopId` int(10) unsigned NOT NULL,
  `unitSold` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`productId`,`productVariantId`,`productSizeId`,`shopId`),
  CONSTRAINT `fk_ProductSaleCount_ProductSku1` FOREIGN KEY (`productId`, `productVariantId`, `productSizeId`, `shopId`) REFERENCES `ProductSku` (`productId`, `productVariantId`, `productSizeId`, `shopId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSeason
CREATE TABLE IF NOT EXISTS `ProductSeason` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `year` year(4) NOT NULL,
  `isActive` tinyint(4) DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSeasonTranslation
CREATE TABLE IF NOT EXISTS `ProductSeasonTranslation` (
  `productSeasonId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`productSeasonId`,`langId`),
  KEY `fk_ProductSeason_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_ProductSeason_has_Lang_ProductSeason1_idx` (`productSeasonId`),
  CONSTRAINT `fk_ProductSeason_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSeason_has_Lang_ProductSeason1` FOREIGN KEY (`productSeasonId`) REFERENCES `ProductSeason` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSheet
CREATE TABLE IF NOT EXISTS `ProductSheet` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `productAttributeId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `group` varchar(45) NOT NULL,
  PRIMARY KEY (`id`,`productAttributeId`),
  KEY `fk_ProductSheet_ProductAttribute1_idx` (`productAttributeId`),
  CONSTRAINT `fk_ProductSheet_ProductAttribute1` FOREIGN KEY (`productAttributeId`) REFERENCES `ProductAttribute` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSheetActual
CREATE TABLE IF NOT EXISTS `ProductSheetActual` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productDetailLabelId` int(10) unsigned NOT NULL,
  `productDetailId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productDetailLabelId`,`productDetailId`),
  KEY `41241241241241_idx` (`productDetailId`),
  KEY `7424124124124_idx` (`productDetailLabelId`),
  CONSTRAINT `441241412412` FOREIGN KEY (`productDetailId`) REFERENCES `ProductDetail` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `7412412412412` FOREIGN KEY (`productDetailLabelId`) REFERENCES `ProductDetailLabel` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_product1112312231` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSheetPrototype
CREATE TABLE IF NOT EXISTS `ProductSheetPrototype` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(45) NOT NULL,
  `group` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSheetPrototypeHasProductDetailLabel
CREATE TABLE IF NOT EXISTS `ProductSheetPrototypeHasProductDetailLabel` (
  `productSheetPrototypeId` int(10) unsigned NOT NULL,
  `productDetailLabelId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productSheetPrototypeId`,`productDetailLabelId`),
  KEY `1245645645645_idx` (`productDetailLabelId`),
  KEY `16456456456451_idx` (`productSheetPrototypeId`),
  CONSTRAINT `1154645645645` FOREIGN KEY (`productSheetPrototypeId`) REFERENCES `ProductSheetPrototype` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `1254645645654` FOREIGN KEY (`productDetailLabelId`) REFERENCES `ProductDetailLabel` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductShippingInfo
CREATE TABLE IF NOT EXISTS `ProductShippingInfo` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productSizeId` int(10) unsigned NOT NULL,
  `boxWidthInMillimiters` int(10) NOT NULL,
  `boxLengthInMillimiters` int(10) NOT NULL,
  `boxHeightInMillimiters` int(10) NOT NULL,
  `boxWeightInGrams` int(10) NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productSizeId`),
  KEY `23_idx` (`productId`,`productVariantId`,`productSizeId`),
  CONSTRAINT `23` FOREIGN KEY (`productId`, `productVariantId`, `productSizeId`) REFERENCES `ProductSku` (`productId`, `productVariantId`, `productSizeId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSize
CREATE TABLE IF NOT EXISTS `ProductSize` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(20) DEFAULT NULL,
  `name` varchar(20) DEFAULT NULL,
  `detail` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSizeGroup
CREATE TABLE IF NOT EXISTS `ProductSizeGroup` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `macroName` varchar(255) NOT NULL,
  `name` varchar(255) NOT NULL,
  `locale` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSizeGroupHasProductSize
CREATE TABLE IF NOT EXISTS `ProductSizeGroupHasProductSize` (
  `productSizeGroupId` int(10) unsigned NOT NULL,
  `productSizeId` int(10) unsigned NOT NULL,
  `position` int(2) unsigned NOT NULL,
  PRIMARY KEY (`productSizeGroupId`,`productSizeId`,`position`),
  KEY `fk_ProductSizeGroup_has_ProductSize_ProductSize1_idx` (`productSizeId`),
  KEY `fk_ProductSizeGroup_has_ProductSize_ProductSizeGroup1_idx` (`productSizeGroupId`),
  CONSTRAINT `fk_ProductSizeGroup_has_ProductSize_ProductSize1` FOREIGN KEY (`productSizeId`) REFERENCES `ProductSize` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSizeGroup_has_ProductSize_ProductSizeGroup1` FOREIGN KEY (`productSizeGroupId`) REFERENCES `ProductSizeGroup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSku
CREATE TABLE IF NOT EXISTS `ProductSku` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productSizeId` int(10) unsigned NOT NULL,
  `shopId` int(10) unsigned NOT NULL,
  `shippingBoxId` int(10) unsigned DEFAULT NULL,
  `currencyId` int(10) unsigned DEFAULT '1',
  `barcode` varchar(45) NOT NULL,
  `stockQty` int(10) unsigned NOT NULL DEFAULT '0',
  `padding` int(10) NOT NULL DEFAULT '0',
  `value` double unsigned NOT NULL DEFAULT '0',
  `price` double unsigned NOT NULL DEFAULT '0',
  `salePrice` double unsigned NOT NULL DEFAULT '0',
  `isOnSale` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`productId`,`productVariantId`,`productSizeId`,`shopId`),
  KEY `fk_ProductSku_ProductSize1_idx123` (`productSizeId`),
  KEY `fk_ProductSku_Shop1_idx456` (`shopId`),
  KEY `fk_productSku_shippingBox_idx` (`shippingBoxId`),
  CONSTRAINT `fk_ProductSku_Product1222222` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSku_ProductSize133333` FOREIGN KEY (`productSizeId`) REFERENCES `ProductSize` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSku_Shop1444444` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductSkuHasProductPhoto
CREATE TABLE IF NOT EXISTS `ProductSkuHasProductPhoto` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `productSizeId` int(10) unsigned NOT NULL,
  `productPhotoId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`productSizeId`,`productPhotoId`),
  KEY `fk_ProductSku_has_ProductPhoto_ProductPhoto1_idx` (`productPhotoId`),
  KEY `fk_ProductSkuHasProductPhoto_ProductSku1_idx` (`productId`,`productVariantId`,`productSizeId`),
  CONSTRAINT `fk_ProductSkuHasProductPhoto_ProductSku1` FOREIGN KEY (`productId`, `productVariantId`, `productSizeId`) REFERENCES `ProductSku` (`productId`, `productVariantId`, `productSizeId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_ProductSku_has_ProductPhoto_ProductPhoto1` FOREIGN KEY (`productPhotoId`) REFERENCES `ProductPhoto` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductStatus
CREATE TABLE IF NOT EXISTS `ProductStatus` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `code` char(1) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `isReady` tinyint(1) NOT NULL DEFAULT '0',
  `isVisible` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `code_UNIQUE` (`code`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ProductVariant
CREATE TABLE IF NOT EXISTS `ProductVariant` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Province
CREATE TABLE IF NOT EXISTS `Province` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `countryId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `code` varchar(45) NOT NULL,
  `regionId` varchar(45) DEFAULT NULL,
  `regionName` varchar(45) DEFAULT NULL,
  `fiscalCode` varchar(45) DEFAULT NULL,
  `externalId` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_Province_Country1_idx` (`countryId`),
  CONSTRAINT `fk_Province_Country1` FOREIGN KEY (`countryId`) REFERENCES `Country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella RbacPermission
CREATE TABLE IF NOT EXISTS `RbacPermission` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `lft` int(10) unsigned NOT NULL,
  `rght` int(10) unsigned NOT NULL,
  `title` varchar(64) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `title` (`title`),
  KEY `lft` (`lft`),
  KEY `rgt` (`rght`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella RbacRole
CREATE TABLE IF NOT EXISTS `RbacRole` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `lft` int(10) unsigned NOT NULL,
  `rght` int(10) unsigned NOT NULL,
  `title` varchar(64) NOT NULL,
  `description` text NOT NULL,
  PRIMARY KEY (`id`),
  KEY `title` (`title`),
  KEY `lft` (`lft`),
  KEY `rgt` (`rght`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella RbacRoleHasRbacPermission
CREATE TABLE IF NOT EXISTS `RbacRoleHasRbacPermission` (
  `rbacRoleId` int(10) unsigned NOT NULL,
  `rbacPermissionId` int(10) unsigned NOT NULL,
  `assignmentDate` datetime NOT NULL,
  PRIMARY KEY (`rbacRoleId`,`rbacPermissionId`),
  KEY `fk_RbacRole_has_RbacPermission_RbacPermission1_idx` (`rbacPermissionId`),
  KEY `fk_RbacRole_has_RbacPermission_RbacRole1_idx` (`rbacRoleId`),
  CONSTRAINT `fk_RbacRole_has_RbacPermission_RbacPermission1` FOREIGN KEY (`rbacPermissionId`) REFERENCES `RbacPermission` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_RbacRole_has_RbacPermission_RbacRole1` FOREIGN KEY (`rbacRoleId`) REFERENCES `RbacRole` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Shipment
CREATE TABLE IF NOT EXISTS `Shipment` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `carrierId` int(10) unsigned NOT NULL,
  `scope` varchar(45) NOT NULL,
  `bookingNumber` varchar(45) DEFAULT NULL,
  `trackingNumber` varchar(45) DEFAULT NULL,
  `predictedShipmentDate` datetime NOT NULL,
  `delivered` binary(1) DEFAULT NULL,
  `creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `declaredValue` double DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_OrderLine_has_Carrier_Carrier1_idx` (`carrierId`),
  CONSTRAINT `fk_OrderLine_has_Carrier_Carrier1` FOREIGN KEY (`carrierId`) REFERENCES `Carrier` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ShippingBox
CREATE TABLE IF NOT EXISTS `ShippingBox` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `weight` int(10) unsigned NOT NULL,
  `width` int(10) unsigned NOT NULL,
  `height` int(10) unsigned NOT NULL,
  `length` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Shop
CREATE TABLE IF NOT EXISTS `Shop` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `title` varchar(255) NOT NULL,
  `owner` varchar(45) NOT NULL,
  `currentSeasonMultiplier` float DEFAULT '35',
  `pastSeasonMultiplier` float DEFAULT '7',
  `referrerEmails` varchar(255) DEFAULT NULL,
  `saleMultiplier` float NOT NULL,
  `importer` varchar(100) DEFAULT NULL,
  `preOrderExport` tinyint(4) DEFAULT '0',
  `orderExport` tinyint(4) DEFAULT '0',
  `billingLogic` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `nome_UNIQUE` (`name`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella ShopHasProduct
CREATE TABLE IF NOT EXISTS `ShopHasProduct` (
  `productId` int(10) unsigned NOT NULL,
  `productVariantId` int(10) unsigned NOT NULL,
  `shopId` int(10) unsigned NOT NULL,
  `extId` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`productId`,`productVariantId`,`shopId`),
  KEY `fk_table1_Product1_idx` (`productId`,`productVariantId`),
  KEY `fk_table1_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_table1_Product1` FOREIGN KEY (`productId`, `productVariantId`) REFERENCES `Product` (`id`, `productVariantId`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_table1_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Sidebar
CREATE TABLE IF NOT EXISTS `Sidebar` (
  `sidebarGroupId` int(10) unsigned NOT NULL,
  `pageId` int(10) unsigned NOT NULL,
  `pageOrder` int(11) DEFAULT NULL,
  `groupOrder` int(3) NOT NULL DEFAULT '0',
  PRIMARY KEY (`sidebarGroupId`,`pageId`),
  KEY `fk_Sidebar_has_Page_Page1_idx` (`pageId`),
  KEY `fk_Sidebar_SidebarGroup1_idx` (`sidebarGroupId`),
  CONSTRAINT `fk_Sidebar_SidebarGroup1` FOREIGN KEY (`sidebarGroupId`) REFERENCES `SidebarGroup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Sidebar_has_Page_Page1` FOREIGN KEY (`pageId`) REFERENCES `Page` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella SidebarGroup
CREATE TABLE IF NOT EXISTS `SidebarGroup` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL,
  `icon` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella SidebarGroupTranslation
CREATE TABLE IF NOT EXISTS `SidebarGroupTranslation` (
  `sidebarGroupId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `title` varchar(255) NOT NULL,
  PRIMARY KEY (`sidebarGroupId`,`langId`),
  KEY `fk_SidebarGroup_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_SidebarGroupTranslation_SidebarGroup1_idx` (`sidebarGroupId`),
  CONSTRAINT `fk_SidebarGroupTranslation_SidebarGroup1` FOREIGN KEY (`sidebarGroupId`) REFERENCES `SidebarGroup` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_SidebarGroup_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella SortingPriority
CREATE TABLE IF NOT EXISTS `SortingPriority` (
  `id` int(10) unsigned NOT NULL,
  `priority` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Tag
CREATE TABLE IF NOT EXISTS `Tag` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `slug` varchar(255) NOT NULL,
  `sortingPriorityId` int(10) unsigned NOT NULL DEFAULT '99',
  PRIMARY KEY (`id`),
  KEY `fk_Tag_SortingPriority1_idx` (`sortingPriorityId`),
  CONSTRAINT `fk_Tag_SortingPriority1` FOREIGN KEY (`sortingPriorityId`) REFERENCES `SortingPriority` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella TagHasLang
CREATE TABLE IF NOT EXISTS `TagHasLang` (
  `tagId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`tagId`,`langId`),
  KEY `fk_Tag_has_Lang_Lang1_idx` (`langId`),
  KEY `fk_Tag_has_Lang_Tag1_idx` (`tagId`),
  CONSTRAINT `fk_Tag_has_Lang_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Tag_has_Lang_Tag1` FOREIGN KEY (`tagId`) REFERENCES `Tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella TagTranslation
CREATE TABLE IF NOT EXISTS `TagTranslation` (
  `tagId` int(10) unsigned NOT NULL,
  `langId` int(10) unsigned NOT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`tagId`,`langId`),
  KEY `fk_TagTranslation_Lang1_idx` (`langId`),
  KEY `fk_TagTranslation_Tag1_idx` (`tagId`),
  CONSTRAINT `fk_TagTranslation_Lang1` FOREIGN KEY (`langId`) REFERENCES `Lang` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_TagTranslation_Tag1` FOREIGN KEY (`tagId`) REFERENCES `Tag` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella TestNs
CREATE TABLE IF NOT EXISTS `TestNs` (
  `id` int(10) unsigned NOT NULL DEFAULT '0',
  `slug` varchar(255) CHARACTER SET utf8 NOT NULL,
  `lft` int(10) unsigned NOT NULL,
  `rght` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `TestNs_lft_uindex` (`lft`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella Token
CREATE TABLE IF NOT EXISTS `Token` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `token` char(128) NOT NULL,
  `tokenType` char(1) NOT NULL,
  `expirationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`,`userId`),
  UNIQUE KEY `token_idx` (`token`,`tokenType`),
  KEY `fk_Token_User` (`userId`),
  KEY `TokenType_idx` (`tokenType`),
  CONSTRAINT `fk_Token_User` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella User
CREATE TABLE IF NOT EXISTS `User` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `langId` int(10) unsigned NOT NULL,
  `username` varchar(45) DEFAULT NULL,
  `password` varchar(60) DEFAULT NULL,
  `email` varchar(254) DEFAULT NULL,
  `registrationEntryPoint` varchar(45) NOT NULL,
  `isActive` tinyint(1) NOT NULL,
  `isDeleted` tinyint(1) NOT NULL,
  `lastSeen` timestamp NULL DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `isEmailChanged` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `email_UNIQUE` (`email`),
  KEY `fk_User_Lang1_idx` (`langId`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserAddress
CREATE TABLE IF NOT EXISTS `UserAddress` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `isBilling` tinyint(1) NOT NULL DEFAULT '0',
  `isDefault` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(45) NOT NULL,
  `surname` varchar(45) NOT NULL,
  `company` varchar(45) DEFAULT NULL,
  `address` varchar(500) NOT NULL,
  `extra` varchar(255) DEFAULT NULL,
  `province` varchar(2) DEFAULT NULL,
  `city` varchar(50) NOT NULL,
  `postcode` varchar(20) DEFAULT NULL,
  `countryId` int(10) unsigned NOT NULL,
  `phone` varchar(45) DEFAULT NULL,
  `lastUsed` tinyint(1) NOT NULL DEFAULT '0',
  `fiscalCode` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`,`userId`),
  KEY `fk_UserEmail_User1_idx` (`userId`),
  KEY `fk_UserAddress_Country1_idx` (`countryId`),
  CONSTRAINT `fk_UserAddress_Country1` FOREIGN KEY (`countryId`) REFERENCES `Country` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_UserEmail_User10` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserBrowser
CREATE TABLE IF NOT EXISTS `UserBrowser` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `calculatedId` char(32) NOT NULL,
  `userAgent` varchar(1000) NOT NULL,
  `accept` varchar(255) NOT NULL,
  `acceptEncoding` varchar(255) NOT NULL,
  `acceptLanguage` varchar(255) NOT NULL,
  `plugins` text NOT NULL,
  `timezone` varchar(255) NOT NULL,
  `screenSizeColorDepth` varchar(255) NOT NULL,
  `cookiesEnabled` tinyint(1) unsigned NOT NULL,
  `superCookie` varchar(255) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserCompany
CREATE TABLE IF NOT EXISTS `UserCompany` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `vat` varchar(45) NOT NULL,
  `position` varchar(45) NOT NULL,
  PRIMARY KEY (`id`,`userId`),
  KEY `fk_UserCompany_User1_idx` (`userId`),
  CONSTRAINT `fk_UserCompany_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserDetails
CREATE TABLE IF NOT EXISTS `UserDetails` (
  `userId` int(10) unsigned NOT NULL,
  `name` varchar(255) DEFAULT NULL,
  `surname` varchar(255) DEFAULT NULL,
  `screenName` varchar(45) DEFAULT NULL,
  `birthDate` date DEFAULT NULL,
  `phone` varchar(45) DEFAULT NULL,
  `gender` char(1) DEFAULT NULL,
  `regDate` datetime DEFAULT NULL,
  `fiscalCode` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`userId`),
  KEY `fk_UserDetails_User1_idx` (`userId`),
  CONSTRAINT `fk_UserDetails_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserEmail
CREATE TABLE IF NOT EXISTS `UserEmail` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `address` varchar(100) NOT NULL,
  `isPrimary` tinyint(1) unsigned NOT NULL,
  PRIMARY KEY (`id`,`userId`),
  KEY `fk_UserEmail_User1_idx` (`userId`),
  CONSTRAINT `fk_UserEmail_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserHasRbacRole
CREATE TABLE IF NOT EXISTS `UserHasRbacRole` (
  `userId` int(10) unsigned NOT NULL,
  `rbacRoleId` int(10) unsigned NOT NULL,
  `assignmentDate` datetime NOT NULL,
  PRIMARY KEY (`userId`,`rbacRoleId`),
  KEY `fk_User_has_RbacRoles_RbacRoles1_idx` (`rbacRoleId`),
  KEY `fk_User_has_RbacRoles_User1_idx` (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserHasShop
CREATE TABLE IF NOT EXISTS `UserHasShop` (
  `userId` int(10) unsigned NOT NULL,
  `shopId` int(10) unsigned NOT NULL,
  PRIMARY KEY (`userId`,`shopId`),
  KEY `fk_Shop_has_User_User1_idx` (`userId`),
  KEY `fk_Shop_has_User_Shop1_idx` (`shopId`),
  CONSTRAINT `fk_Shop_has_User_Shop1` FOREIGN KEY (`shopId`) REFERENCES `Shop` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_Shop_has_User_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserPrivacy
CREATE TABLE IF NOT EXISTS `UserPrivacy` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `name` varchar(45) NOT NULL,
  `isActive` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`,`userId`),
  KEY `fk_UserEmail_User1_idx` (`userId`),
  CONSTRAINT `fk_UserEmail_User11` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserRegistrationToken
CREATE TABLE IF NOT EXISTS `UserRegistrationToken` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `token` varchar(64) NOT NULL,
  `expiration` datetime DEFAULT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `fk_RegistrationToken_User1_idx` (`userId`),
  CONSTRAINT `fk_RegistrationToken_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;


-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserSessionHasOrder
CREATE TABLE IF NOT EXISTS `UserSessionHasOrder` (
  `userSessionSid` char(64) NOT NULL,
  `orderId` int(10) unsigned zerofill NOT NULL,
  PRIMARY KEY (`userSessionSid`,`orderId`),
  KEY `fk_UserSession_has_Order_Order1_idx` (`orderId`),
  KEY `fk_UserSession_has_Order_UserSession1_idx` (`userSessionSid`),
  CONSTRAINT `fk_UserSession_has_Order_Order1` FOREIGN KEY (`orderId`) REFERENCES `Order` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_UserSession_has_Order_UserSession1` FOREIGN KEY (`userSessionSid`) REFERENCES `UserSession` (`sid`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di tabella UserToken
CREATE TABLE IF NOT EXISTS `UserToken` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `userId` int(10) unsigned NOT NULL,
  `token` varchar(1000) NOT NULL,
  `expirationDate` datetime NOT NULL,
  `creationDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`,`userId`),
  KEY `fk_UserToken_User1_idx` (`userId`),
  CONSTRAINT `fk_UserToken_User1` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di vista vBluesealCouponEventList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealCouponEventList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `name` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `description` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `click` INT(10) NOT NULL,
  `startDate` DATETIME NOT NULL,
  `endDate` DATETIME NOT NULL,
  `couponType` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealCouponList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealCouponList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `couponTypeId` INT(10) UNSIGNED NOT NULL,
  `tagId` INT(10) UNSIGNED NULL,
  `code` VARCHAR(19) NOT NULL COLLATE 'utf8_general_ci',
  `issueDate` DATETIME NOT NULL,
  `validThru` DATETIME NULL,
  `amount` SMALLINT(5) UNSIGNED NOT NULL,
  `amountType` CHAR(1) NOT NULL COLLATE 'utf8_general_ci',
  `userId` INT(10) UNSIGNED NULL,
  `valid` BINARY(1) NOT NULL,
  `couponType` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `validForCartTotal` INT(11) NOT NULL,
  `utente` VARCHAR(511) NULL COLLATE 'utf8_general_ci',
  `orderId` INT(10) UNSIGNED ZEROFILL NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealCouponTypeList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealCouponTypeList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `name` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `amount` SMALLINT(5) UNSIGNED NULL,
  `amountType` CHAR(1) NOT NULL COLLATE 'utf8_general_ci',
  `validity` VARCHAR(50) NOT NULL COLLATE 'utf8_general_ci',
  `validForCartTotal` INT(11) NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryBrandEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryBrandEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryBrandList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryBrandList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryCategoryEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryCategoryEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(95) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryCategoryList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryCategoryList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryColorEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryColorEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryColorList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryColorList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionarySeasonEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionarySeasonEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionarySeasonList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionarySeasonList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionarySizeEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionarySizeEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionarySizeList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionarySizeList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryTagEdit
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryTagEdit` (
  `shopId` INT(10) UNSIGNED NOT NULL,
  `term` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `foreign` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDictionaryTagList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDictionaryTagList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `count` BIGINT(21) NOT NULL,
  `mancanti` BIGINT(21) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealDirtyProductList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealDirtyProductList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `name` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `title` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `owner` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `args` VARCHAR(255) NULL COLLATE 'utf8_swedish_ci',
  `active` TINYINT(1) NOT NULL,
  `running` TINYINT(1) NOT NULL,
  `jobId` INT(11) NOT NULL,
  `jobName` VARCHAR(45) NOT NULL COLLATE 'utf8_swedish_ci',
  `jobCommand` VARCHAR(255) NOT NULL COLLATE 'utf8_swedish_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealOrders
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealOrders` (
  `id` INT(10) UNSIGNED ZEROFILL NOT NULL,
  `user` VARCHAR(511) NULL COLLATE 'utf8_general_ci',
  `name` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `surname` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `email` VARCHAR(254) NULL COLLATE 'utf8_general_ci',
  `orderDate` TIMESTAMP NULL,
  `lastUpdate` TIMESTAMP NULL,
  `product` VARCHAR(21) NOT NULL COLLATE 'utf8mb4_general_ci',
  `shop` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `status` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `statusCode` VARCHAR(15) NOT NULL COLLATE 'utf8_general_ci',
  `payment` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `orderLineStatus` VARCHAR(45) NOT NULL COLLATE 'utf8_swedish_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealPostList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealPostList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `blogId` INT(10) UNSIGNED NOT NULL,
  `postStatusId` INT(10) UNSIGNED NOT NULL,
  `langId` INT(10) UNSIGNED NOT NULL,
  `userId` INT(10) UNSIGNED NOT NULL,
  `author` VARCHAR(255) NOT NULL COLLATE 'utf8_swedish_ci',
  `hits` INT(10) NOT NULL,
  `coverImage` VARCHAR(255) NOT NULL COLLATE 'utf8_swedish_ci',
  `title` VARCHAR(255) NOT NULL COLLATE 'utf8_swedish_ci',
  `subtitle` LONGTEXT NOT NULL COLLATE 'utf8_swedish_ci',
  `content` LONGTEXT NOT NULL COLLATE 'utf8_swedish_ci',
  `name` VARCHAR(45) NOT NULL COLLATE 'utf8_swedish_ci',
  `creationDate` DATETIME NOT NULL,
  `status` DATETIME NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductActive
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductActive` (
  `id` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `code` VARCHAR(21) NOT NULL COLLATE 'utf8_general_ci',
  `shops` TEXT NULL COLLATE 'utf8_general_ci',
  `tag` INT(10) UNSIGNED NOT NULL,
  `status` VARCHAR(45) NULL COLLATE 'utf8_swedish_ci',
  `productPriority` INT(10) UNSIGNED NOT NULL,
  `tagPriority` INT(10) UNSIGNED NULL,
  `brand` VARCHAR(100) NOT NULL COLLATE 'utf8_general_ci',
  `totalQty` DECIMAL(32,0) NULL,
  `creation` DATETIME NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductDescriptionList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductDescriptionList` (
  `productId` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `marketplaceId` INT(1) NOT NULL,
  `langId` INT(10) UNSIGNED NOT NULL,
  `lang` VARCHAR(2) NOT NULL COLLATE 'utf8_general_ci',
  `langName` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `description` TEXT NOT NULL COLLATE 'utf8_general_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductDetailList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductDetailList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `slug` VARCHAR(255) NOT NULL COLLATE 'utf8_swedish_ci',
  `name` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `langId` INT(10) UNSIGNED NOT NULL,
  `lang` VARCHAR(2) NOT NULL COLLATE 'utf8_general_ci',
  `langName` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `conto` BIGINT(21) NOT NULL,
  `quanti` DECIMAL(32,0) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductImporter
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductImporter` (
  `id` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `code` VARCHAR(290) NOT NULL COLLATE 'utf8_general_ci',
  `shop` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `shopId` INT(10) UNSIGNED NOT NULL,
  `brand` VARCHAR(100) NOT NULL COLLATE 'utf8_general_ci',
  `externalId` VARCHAR(45) NULL COLLATE 'utf8_general_ci',
  `status` VARCHAR(45) NULL COLLATE 'utf8_swedish_ci',
  `creationDate` DATETIME NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductIncomplete
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductIncomplete` (
  `id` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NULL,
  `shop` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `code` VARCHAR(290) NULL COLLATE 'utf8_general_ci',
  `season` INT(10) UNSIGNED NULL,
  `externalId` VARCHAR(45) NULL COLLATE 'utf8_general_ci',
  `brand` VARCHAR(100) NULL COLLATE 'utf8_general_ci',
  `totalQty` DECIMAL(32,0) NULL,
  `status` VARCHAR(45) NULL COLLATE 'utf8_swedish_ci',
  `creationDate` DATETIME NOT NULL,
  `problems` VARCHAR(44) NULL COLLATE 'utf8_general_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductList` (
  `codice` VARCHAR(21) NOT NULL COLLATE 'utf8_general_ci',
  `id` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `cpf` VARCHAR(290) NOT NULL COLLATE 'utf8_general_ci',
  `shop` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `externalId` VARCHAR(45) NULL COLLATE 'utf8_general_ci',
  `brand` VARCHAR(100) NOT NULL COLLATE 'utf8_general_ci',
  `status` VARCHAR(45) NULL COLLATE 'utf8_swedish_ci',
  `creationDate` DATETIME NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `slug` VARCHAR(255) NOT NULL COLLATE 'utf8_bin'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealProductNameList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealProductNameList` (
  `productId` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `langId` INT(10) UNSIGNED NOT NULL,
  `lang` VARCHAR(2) NOT NULL COLLATE 'utf8_general_ci',
  `langName` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci',
  `name` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `conto` BIGINT(21) NOT NULL,
  `quanti` DECIMAL(32,0) NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealTagList
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealTagList` (
  `id` INT(10) UNSIGNED NOT NULL,
  `slug` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci',
  `priority` VARCHAR(45) NOT NULL COLLATE 'utf8_general_ci'
) ENGINE=MyISAM;

-- Dump della struttura di vista vBluesealUsers
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vBluesealUsers` (
  `id` INT(10) UNSIGNED NOT NULL,
  `name` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `surname` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `email` VARCHAR(254) NULL COLLATE 'utf8_general_ci',
  `sex` VARCHAR(5) NOT NULL COLLATE 'utf8_general_ci',
  `status` VARCHAR(11) NOT NULL COLLATE 'utf8_general_ci',
  `creationDate` TIMESTAMP NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vCategories
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vCategories` (
  `fatherId` INT(10) UNSIGNED NOT NULL,
  `id` INT(10) UNSIGNED NOT NULL,
  `depth` BIGINT(21) NULL,
  `visible` BIGINT(21) NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vProductShopView
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vProductShopView` (
  `id` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `itemno` VARCHAR(32) NOT NULL COLLATE 'utf8_general_ci',
  `creationDate` DATETIME NOT NULL,
  `dummyPicture` VARCHAR(100) NULL COLLATE 'utf8_general_ci',
  `productSeasonId` INT(10) UNSIGNED NULL,
  `productBrandId` INT(10) UNSIGNED NOT NULL,
  `sortingPriorityId` INT(10) UNSIGNED NOT NULL,
  `sizeGroupId` INT(11) NULL,
  `externalId` VARCHAR(45) NULL COLLATE 'utf8_general_ci',
  `note` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `sheetName` VARCHAR(45) NULL COLLATE 'utf8_general_ci',
  `lastUpdate` DATETIME NULL,
  `status` CHAR(1) NOT NULL COLLATE 'utf8_general_ci',
  `shopId` INT(10) UNSIGNED NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vProductSortingView
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vProductSortingView` (
  `product` INT(10) UNSIGNED NOT NULL,
  `variant` INT(10) UNSIGNED NOT NULL,
  `shop` INT(10) UNSIGNED NOT NULL,
  `tag` INT(10) UNSIGNED NOT NULL,
  `price` DOUBLE NULL,
  `productPriority` INT(10) UNSIGNED NOT NULL,
  `tagPriority` INT(10) UNSIGNED NOT NULL,
  `brand` INT(10) UNSIGNED NOT NULL,
  `size` INT(10) UNSIGNED NOT NULL,
  `color` DECIMAL(10,0) NULL,
  `category` INT(10) UNSIGNED NOT NULL,
  `lft` INT(10) UNSIGNED NOT NULL,
  `maxQty` INT(10) UNSIGNED NULL,
  `creation` DATETIME NOT NULL
) ENGINE=MyISAM;

-- Dump della struttura di vista vRepairNestedSet
-- Creazione di una tabella temporanea per risolvere gli errori di dipendenza della vista
CREATE TABLE `vRepairNestedSet` (
  `pid` INT(10) UNSIGNED NULL,
  `pname` VARCHAR(255) NULL COLLATE 'utf8_general_ci',
  `cid` INT(10) UNSIGNED NOT NULL,
  `cname` VARCHAR(255) NOT NULL COLLATE 'utf8_general_ci'
) ENGINE=MyISAM;

-- Dump della struttura di tabella ZipCode
CREATE TABLE IF NOT EXISTS `ZipCode` (
  `id` int(11) NOT NULL,
  `cityId` int(11) NOT NULL,
  `zipCode` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `fk_ZipCode_City1_idx` (`cityId`),
  CONSTRAINT `fk_ZipCode_City1` FOREIGN KEY (`cityId`) REFERENCES `City` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_unicode_ci;

-- L’esportazione dei dati non era selezionata.
-- Dump della struttura di trigger OrderLine_BEFORE_INSERT
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `OrderLine_BEFORE_INSERT` BEFORE INSERT ON `OrderLine` FOR EACH ROW BEGIN
  SELECT COALESCE(MAX(`id`) + 1, 1) INTO @`id` FROM OrderLine WHERE `orderId` = NEW.`orderId`;
  SET NEW.`id` = @`id`;
END//
DELIMITER ;

-- Dump della struttura di trigger OrderLine_BEFORE_UPDATE
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `OrderLine_BEFORE_UPDATE` BEFORE UPDATE ON `OrderLine` FOR EACH ROW BEGIN
  SET NEW.lastUpdate = current_timestamp();
END//
DELIMITER ;

-- Dump della struttura di trigger Order_BEFORE_UPDATE
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `Order_BEFORE_UPDATE` BEFORE UPDATE ON `Order` FOR EACH ROW BEGIN
  SET NEW.lastUpdate = current_timestamp();
  IF (NEW.paidAmount is not null AND OLD.paidAmount is null)
  THEN
    SET NEW.paymentDate = current_timestamp();
  END IF;
END//
DELIMITER ;

-- Dump della struttura di trigger Post_BEFORE_INSERT
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `Post_BEFORE_INSERT` BEFORE INSERT ON `Post` FOR EACH ROW BEGIN
  SELECT COALESCE(MAX(`id`) + 1, 1) INTO @`id` FROM Post WHERE `blogId` = NEW.`blogId`;
  SET NEW.`id` = @`id`;
END//
DELIMITER ;

-- Dump della struttura di trigger UserSession_BEFORE_UPDATE
SET @OLDTMP_SQL_MODE=@@SQL_MODE, SQL_MODE='STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ALLOW_INVALID_DATES,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
DELIMITER //
CREATE TRIGGER `UserSession_BEFORE_UPDATE` BEFORE UPDATE ON `UserSession` FOR EACH ROW BEGIN
  SET NEW.lastUpdate = current_timestamp();
END//
DELIMITER ;

-- Dump della struttura di vista vBluesealCouponEventList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealCouponEventList` AS select `CouponEvent`.`id` AS `id`,`CouponEvent`.`name` AS `name`,`CouponEvent`.`description` AS `description`,`CouponEvent`.`click` AS `click`,`CouponEvent`.`startDate` AS `startDate`,`CouponEvent`.`endDate` AS `endDate`,`CouponType`.`name` AS `couponType` from (`CouponEvent` join `CouponType` on((`CouponEvent`.`couponTypeId` = `CouponType`.`id`)));

-- Dump della struttura di vista vBluesealCouponList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealCouponList` AS select `Coupon`.`id` AS `id`,`Coupon`.`couponTypeId` AS `couponTypeId`,`Coupon`.`tagId` AS `tagId`,`Coupon`.`code` AS `code`,`Coupon`.`issueDate` AS `issueDate`,`Coupon`.`validThru` AS `validThru`,`Coupon`.`amount` AS `amount`,`Coupon`.`amountType` AS `amountType`,`Coupon`.`userId` AS `userId`,`Coupon`.`valid` AS `valid`,`CouponType`.`name` AS `couponType`,`CouponType`.`validForCartTotal` AS `validForCartTotal`,concat(`UserDetails`.`name`,' ',`UserDetails`.`surname`) AS `utente`,`Order`.`id` AS `orderId` from (((`Coupon` join `CouponType` on((`Coupon`.`couponTypeId` = `CouponType`.`id`))) left join `UserDetails` on((`UserDetails`.`userId` = `Coupon`.`userId`))) left join `Order` on((`Order`.`couponId` = `Coupon`.`id`)));

-- Dump della struttura di vista vBluesealCouponTypeList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealCouponTypeList` AS select `CouponType`.`id` AS `id`,`CouponType`.`name` AS `name`,`CouponType`.`amount` AS `amount`,`CouponType`.`amountType` AS `amountType`,`CouponType`.`validity` AS `validity`,`CouponType`.`validForCartTotal` AS `validForCartTotal` from `CouponType`;

-- Dump della struttura di vista vBluesealDictionaryBrandEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryBrandEdit` AS select `DictionaryBrand`.`shopId` AS `shopId`,`DictionaryBrand`.`term` AS `term`,`DictionaryBrand`.`productBrandId` AS `foreign` from `DictionaryBrand`;

-- Dump della struttura di vista vBluesealDictionaryBrandList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryBrandList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionaryBrand` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`productBrandId`))) AS `mancanti` from `DictionaryBrand` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDictionaryCategoryEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryCategoryEdit` AS select `DictionaryCategory`.`shopId` AS `shopId`,`DictionaryCategory`.`term` AS `term`,`DictionaryCategory`.`productCategoryId` AS `foreign` from `DictionaryCategory`;

-- Dump della struttura di vista vBluesealDictionaryCategoryList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryCategoryList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionaryCategory` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`productCategoryId`))) AS `mancanti` from `DictionaryCategory` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDictionaryColorEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryColorEdit` AS select `DictionaryColorGroup`.`shopId` AS `shopId`,`DictionaryColorGroup`.`term` AS `term`,`DictionaryColorGroup`.`productColorGroupId` AS `foreign` from `DictionaryColorGroup`;

-- Dump della struttura di vista vBluesealDictionaryColorList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryColorList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionaryColorGroup` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`productColorGroupId`))) AS `mancanti` from `DictionaryColorGroup` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDictionarySeasonEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionarySeasonEdit` AS select `DictionarySeason`.`shopId` AS `shopId`,`DictionarySeason`.`term` AS `term`,`DictionarySeason`.`productSeasonId` AS `foreign` from `DictionarySeason`;

-- Dump della struttura di vista vBluesealDictionarySeasonList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionarySeasonList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionarySeason` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`productSeasonId`))) AS `mancanti` from `DictionarySeason` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDictionarySizeEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionarySizeEdit` AS select `DictionarySize`.`shopId` AS `shopId`,`DictionarySize`.`term` AS `term`,`DictionarySize`.`productSizeId` AS `foreign` from `DictionarySize`;

-- Dump della struttura di vista vBluesealDictionarySizeList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionarySizeList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionarySize` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`productSizeId`))) AS `mancanti` from `DictionarySize` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDictionaryTagEdit
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryTagEdit` AS select `DictionaryTag`.`shopId` AS `shopId`,`DictionaryTag`.`term` AS `term`,`DictionaryTag`.`tagId` AS `foreign` from `DictionaryTag`;

-- Dump della struttura di vista vBluesealDictionaryTagList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDictionaryTagList` AS select `d1`.`shopId` AS `id`,`d1`.`shopId` AS `shopId`,count(0) AS `count`,(select count(0) AS `count` from `DictionaryTag` `d2` where ((`d2`.`shopId` = `d1`.`shopId`) and isnull(`d2`.`tagId`))) AS `mancanti` from `DictionaryTag` `d1` group by `d1`.`shopId`;

-- Dump della struttura di vista vBluesealDirtyProductList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealDirtyProductList` AS select `s`.`id` AS `id`,`s`.`name` AS `name`,`s`.`title` AS `title`,`s`.`owner` AS `owner`,`j`.`defaultArgs` AS `args`,`j`.`isActive` AS `active`,`j`.`isRunning` AS `running`,`j`.`id` AS `jobId`,`j`.`name` AS `jobName`,`j`.`command` AS `jobCommand` from (`Shop` `s` join `Job` `j`) where (`s`.`id` in (select distinct `DirtyProduct`.`shopId` from `DirtyProduct`) and (`s`.`id` = `j`.`defaultArgs`));

-- Dump della struttura di vista vBluesealOrders
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealOrders` AS select `o`.`id` AS `id`,concat(`ud`.`name`,' ',`ud`.`surname`) AS `user`,`ud`.`name` AS `name`,`ud`.`surname` AS `surname`,`u`.`email` AS `email`,`o`.`orderDate` AS `orderDate`,`o`.`lastUpdate` AS `lastUpdate`,concat(`ol`.`productId`,'-',`ol`.`productVariantId`) AS `product`,`s`.`title` AS `shop`,`os`.`title` AS `status`,`o`.`status` AS `statusCode`,`opm`.`name` AS `payment`,`ols`.`title` AS `orderLineStatus` from ((((((((`Order` `o` join `User` `u`) join `UserDetails` `ud`) join `OrderPaymentMethod` `opm`) join `OrderStatus` `os`) join `OrderStatusHasLang` `oshl`) join `OrderLine` `ol`) join `Shop` `s`) join `OrderLineStatus` `ols`) where ((`o`.`userId` = `u`.`id`) and (`ud`.`userId` = `u`.`id`) and (`o`.`orderPaymentMethodId` = `opm`.`id`) and (`o`.`status` = `os`.`code`) and (`o`.`status` like 'ORD%') and (`oshl`.`orderStatusId` = `os`.`id`) and (`ol`.`orderId` = `o`.`id`) and (`s`.`id` = `ol`.`shopId`) and (`ol`.`status` = convert(`ols`.`code` using utf8)));

-- Dump della struttura di vista vBluesealPostList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealPostList` AS select `p`.`id` AS `id`,`p`.`blogId` AS `blogId`,`p`.`postStatusId` AS `postStatusId`,`pt`.`langId` AS `langId`,`p`.`userId` AS `userId`,`p`.`author` AS `author`,`p`.`hits` AS `hits`,`pt`.`coverImage` AS `coverImage`,`pt`.`title` AS `title`,`pt`.`subtitle` AS `subtitle`,`pt`.`content` AS `content`,`ps`.`name` AS `name`,`p`.`creationDate` AS `creationDate`,`p`.`publishDate` AS `status` from ((`Post` `p` join `PostTranslation` `pt` on(((`p`.`id` = `pt`.`postId`) and (`p`.`blogId` = `pt`.`blogId`)))) join `PostStatus` `ps` on((`p`.`postStatusId` = `ps`.`id`)));

-- Dump della struttura di vista vBluesealProductActive
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`ilsalvagente`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealProductActive` AS select `Product`.`id` AS `id`,`Product`.`productVariantId` AS `productVariantId`,concat(`Product`.`id`,'-',`Product`.`productVariantId`) AS `code`,group_concat(distinct `Shop`.`title` separator ',') AS `shops`,`Tag`.`id` AS `tag`,`ProductStatus`.`name` AS `status`,`Product`.`sortingPriorityId` AS `productPriority`,min(`Tag`.`sortingPriorityId`) AS `tagPriority`,`ProductBrand`.`name` AS `brand`,sum(`ProductSku`.`stockQty`) AS `totalQty`,`Product`.`creationDate` AS `creation` from (((((((`Product` join `Tag`) join `ProductSku`) join `ProductHasTag`) join `ProductBrand`) join `ProductStatus`) join `Shop`) join `ProductHasProductPhoto`) where ((`ProductHasTag`.`productId` = `Product`.`id`) and (`ProductSku`.`shopId` = `Shop`.`id`) and (`ProductHasTag`.`productVariantId` = `Product`.`productVariantId`) and (convert(`ProductStatus`.`code` using utf8) = `Product`.`status`) and (`Product`.`status` in ('A','P','N')) and (`ProductHasTag`.`tagId` = `Tag`.`id`) and (`Product`.`id` = `ProductSku`.`productId`) and (`ProductSku`.`price` > 0) and (`Product`.`id` = `ProductHasProductPhoto`.`productId`) and (`Product`.`productVariantId` = `ProductHasProductPhoto`.`productVariantId`) and (`Product`.`productVariantId` = `ProductSku`.`productVariantId`) and (`ProductBrand`.`id` = `Product`.`productBrandId`)) group by `Product`.`id`,`Product`.`productVariantId`,`ProductSku`.`price` having (`totalQty` >= 0) order by `Product`.`creationDate` desc;

-- Dump della struttura di vista vBluesealProductDescriptionList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealProductDescriptionList` AS select `pd`.`productId` AS `productId`,`pd`.`productVariantId` AS `productVariantId`,1 AS `marketplaceId`,`pd`.`langId` AS `langId`,`l`.`lang` AS `lang`,`l`.`name` AS `langName`,`pd`.`description` AS `description` from (`ProductDescriptionTranslation` `pd` join `Lang` `l`) where ((`pd`.`langId` = `l`.`id`) and (`pd`.`description` <> '') and (`pd`.`description` <> '<br>') and (`pd`.`description` <> '<br><br>'));

-- Dump della struttura di vista vBluesealProductDetailList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealProductDetailList` AS select `pd`.`id` AS `id`,`pd`.`slug` AS `slug`,`pdt`.`name` AS `name`,`pdt`.`langId` AS `langId`,`l`.`lang` AS `lang`,`l`.`name` AS `langName`,count(`psa`.`productVariantId`) AS `conto`,sum(`ps`.`stockQty`) AS `quanti` from ((((`ProductDetail` `pd` join `ProductSheetActual` `psa`) join `ProductSku` `ps`) join `ProductDetailTranslation` `pdt`) join `Lang` `l`) where ((`pd`.`id` = `psa`.`productDetailId`) and (`psa`.`productId` = `ps`.`productId`) and (`psa`.`productVariantId` = `ps`.`productVariantId`) and (`pd`.`id` = `pdt`.`productDetailId`) and (`pdt`.`langId` = `l`.`id`) and (`pd`.`slug` <> '')) group by `psa`.`productDetailId` having (`quanti` > 0);

-- Dump della struttura di vista vBluesealProductImporter
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealProductImporter` AS select `p`.`id` AS `id`,`p`.`productVariantId` AS `productVariantId`,concat(`p`.`itemno`,' # ',`pv`.`name`) AS `code`,`s`.`name` AS `shop`,`s`.`id` AS `shopId`,`pb`.`name` AS `brand`,`p`.`externalId` AS `externalId`,`ps`.`name` AS `status`,`p`.`creationDate` AS `creationDate` from (((((((`Product` `p` join `ShopHasProduct` `sp`) join `Shop` `s`) join `DirtyProduct` `dp`) join `DirtySku` `ds`) join `ProductBrand` `pb`) join `ProductStatus` `ps`) join `ProductVariant` `pv`) where ((`p`.`status` not in ('N','C')) and (`p`.`id` = `sp`.`productId`) and (convert(`ps`.`code` using utf8) = `p`.`status`) and (`p`.`productBrandId` = `pb`.`id`) and (`p`.`productVariantId` = `sp`.`productVariantId`) and (`sp`.`shopId` = `s`.`id`) and (`s`.`id` = `dp`.`shopId`) and (`s`.`id` = `ds`.`shopId`) and (`s`.`importer` is not null) and (`dp`.`id` = `ds`.`dirtyProductId`) and (`p`.`id` = `dp`.`productId`) and (`p`.`productVariantId` = `dp`.`productVariantId`) and (`dp`.`dirtyStatus` = 'K') and (`ds`.`status` <> 'ok') and (`pv`.`id` = `p`.`productVariantId`));

-- Dump della struttura di vista vBluesealProductIncomplete
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealProductIncomplete` AS select `p`.`id` AS `id`,`p`.`productVariantId` AS `productVariantId`,`sp`.`shopId` AS `shopId`,`s`.`name` AS `shop`,concat(`p`.`itemno`,' # ',`pv`.`name`) AS `code`,`p`.`productSeasonId` AS `season`,`p`.`externalId` AS `externalId`,`pb`.`name` AS `brand`,sum(`pk`.`stockQty`) AS `totalQty`,`ps`.`name` AS `status`,`p`.`creationDate` AS `creationDate`,concat_ws(' ',if(isnull(`p`.`sizeGroupId`),'E400',NULL),if(isnull(`p`.`productSeasonId`),'E410',NULL),if((`p`.`productBrandId` = 1),'E420',NULL),if(isnull(`p`.`sheetName`),'E430',NULL),if(isnull(`pc`.`productColorGroupId`),'E440',NULL),if(isnull(`pp`.`productId`),'E450',NULL),if(isnull(`pk`.`productId`),'E460',NULL),if(isnull(`pn`.`name`),'E470',NULL),if(isnull(`pd`.`productId`),'E480',NULL)) AS `problems` from ((((((((((`Product` `p` left join `ShopHasProduct` `sp` on(((`p`.`id` = `sp`.`productId`) and (`p`.`productVariantId` = `sp`.`productVariantId`)))) left join `ProductHasProductColorGroup` `pc` on(((`pc`.`productId` = `p`.`id`) and (`pc`.`productVariantId` = `p`.`productVariantId`)))) left join `ProductName` `pn` on(((`pn`.`productId` = `p`.`id`) and (`pn`.`productVariantId` = `p`.`productVariantId`)))) left join `ProductBrand` `pb` on((`p`.`productBrandId` = `pb`.`id`))) left join `Shop` `s` on((`s`.`id` = `sp`.`shopId`))) left join `ProductVariant` `pv` on((`p`.`productVariantId` = `pv`.`id`))) left join `ProductStatus` `ps` on((convert(`ps`.`code` using utf8) = `p`.`status`))) left join `ProductSku` `pk` on(((`p`.`id` = `pk`.`productId`) and (`p`.`productVariantId` = `pk`.`productVariantId`)))) left join `ProductHasProductPhoto` `pp` on(((`p`.`id` = `pp`.`productId`) and (`p`.`productVariantId` = `pp`.`productVariantId`)))) left join `ProductDescription` `pd` on(((`p`.`id` = `pd`.`productId`) and (`p`.`productVariantId` = `pd`.`productVariantId`)))) where ((`p`.`status` not in ('C','N')) and (`pn`.`langId` = 1) and (`pn`.`name` = '') and (isnull(`pc`.`productColorGroupId`) or isnull(`p`.`sizeGroupId`) or isnull(`p`.`productSeasonId`) or (`p`.`productBrandId` = 1) or isnull(`p`.`sheetName`) or ((`p`.`status` in ('W','G')) and (`p`.`dummyPicture` <> '0000000000.jpg')))) group by `p`.`id`,`p`.`productVariantId` having (`totalQty` > 0) order by `p`.`creationDate` desc;

-- Dump della struttura di vista vBluesealProductList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealProductList` AS select concat(`p`.`id`,'-',`pv`.`id`) AS `codice`,`p`.`id` AS `id`,`p`.`productVariantId` AS `productVariantId`,concat(`p`.`itemno`,' # ',`pv`.`name`) AS `cpf`,`s`.`name` AS `shop`,`p`.`externalId` AS `externalId`,`pb`.`name` AS `brand`,`ps`.`name` AS `status`,`p`.`creationDate` AS `creationDate`,`s`.`id` AS `shopId`,`pc`.`slug` AS `slug` from (((((((`Product` `p` join `ProductVariant` `pv`) join `ProductBrand` `pb`) join `ProductStatus` `ps`) join `ShopHasProduct` `sp`) join `Shop` `s`) join `ProductCategory` `pc`) join `ProductHasProductCategory` `ppc`) where ((`p`.`productVariantId` = `pv`.`id`) and (`p`.`productBrandId` = `pb`.`id`) and (((`p`.`id` = `sp`.`productId`) and (`p`.`productVariantId` = `sp`.`productVariantId`)) or (isnull(`sp`.`productId`) and isnull(`sp`.`productVariantId`))) and (`sp`.`shopId` = `s`.`id`) and (convert(`ps`.`code` using utf8) = `p`.`status`) and (`pc`.`id` = `ppc`.`productCategoryId`) and (((`p`.`id` = `ppc`.`productId`) and (`p`.`productVariantId` = `ppc`.`productVariantId`)) or (isnull(`ppc`.`productId`) and isnull(`ppc`.`productVariantId`))));

-- Dump della struttura di vista vBluesealProductNameList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealProductNameList` AS select `pn`.`productId` AS `productId`,`pn`.`productVariantId` AS `productVariantId`,`pn`.`langId` AS `langId`,`l`.`lang` AS `lang`,`l`.`name` AS `langName`,`pn`.`name` AS `name`,count(`pn`.`productVariantId`) AS `conto`,sum(`ps`.`stockQty`) AS `quanti` from ((`ProductNameTranslation` `pn` join `ProductSku` `ps`) join `Lang` `l`) where ((`pn`.`langId` = `l`.`id`) and (`pn`.`productId` = `ps`.`productId`) and (`pn`.`productVariantId` = `ps`.`productVariantId`)) group by `pn`.`productId`,`pn`.`productVariantId` having (`quanti` > 0);

-- Dump della struttura di vista vBluesealTagList
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`79.6.214.120` SQL SECURITY DEFINER VIEW `vBluesealTagList` AS select `Tag`.`id` AS `id`,`Tag`.`slug` AS `slug`,`SortingPriority`.`priority` AS `priority` from (`Tag` join `SortingPriority` on((`Tag`.`sortingPriorityId` = `SortingPriority`.`id`)));

-- Dump della struttura di vista vBluesealUsers
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vBluesealUsers` AS select `u`.`id` AS `id`,`ud`.`name` AS `name`,`ud`.`surname` AS `surname`,`u`.`email` AS `email`,if((`ud`.`gender` = 'F'),'Donna','Uomo') AS `sex`,if((`u`.`isActive` = 1),'Attivato','Disattivato') AS `status`,`u`.`creationDate` AS `creationDate` from (`User` `u` join `UserDetails` `ud`) where (`u`.`id` = `ud`.`userId`) order by `u`.`creationDate` desc;

-- Dump della struttura di vista vCategories
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vCategories` AS select `father`.`id` AS `fatherId`,`parent`.`id` AS `id`,(select count(`parent2`.`id`) from `ProductCategory` `parent2` where ((`parent`.`lft` > `parent2`.`lft`) and (`parent`.`rght` < `parent2`.`rght`))) AS `depth`,count(distinct `phpc`.`product`,`phpc`.`variant`) AS `visible` from (((`ProductCategory` `node` join `ProductCategory` `parent`) join `vProductSortingView` `phpc`) join `ProductCategory` `father`) where ((`node`.`lft` between `parent`.`lft` and `parent`.`rght`) and (`node`.`id` = `phpc`.`category`) and (`parent`.`lft` between `father`.`lft` and `father`.`rght`)) group by `parent`.`id` having ((`depth` between 1 and 3) and (`visible` > 0)) order by `parent`.`lft`;

-- Dump della struttura di vista vProductShopView
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`ilsalvagente`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vProductShopView` AS select `p`.`id` AS `id`,`p`.`productVariantId` AS `productVariantId`,`p`.`itemno` AS `itemno`,`p`.`creationDate` AS `creationDate`,`p`.`dummyPicture` AS `dummyPicture`,`p`.`productSeasonId` AS `productSeasonId`,`p`.`productBrandId` AS `productBrandId`,`p`.`sortingPriorityId` AS `sortingPriorityId`,`p`.`sizeGroupId` AS `sizeGroupId`,`p`.`externalId` AS `externalId`,`p`.`note` AS `note`,`p`.`sheetName` AS `sheetName`,`p`.`lastUpdate` AS `lastUpdate`,`p`.`status` AS `status`,`sp`.`shopId` AS `shopId` from (`Product` `p` left join `ShopHasProduct` `sp` on(((`p`.`id` = `sp`.`productId`) and (`p`.`productVariantId` = `sp`.`productVariantId`)))) where (isnull(`sp`.`productId`) or (`sp`.`productId` is not null));

-- Dump della struttura di vista vProductSortingView
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vProductSortingView` AS select `Product`.`id` AS `product`,`Product`.`productVariantId` AS `variant`,`ProductSku`.`shopId` AS `shop`,`Tag`.`id` AS `tag`,min(`ProductSku`.`price`) AS `price`,`Product`.`sortingPriorityId` AS `productPriority`,`Tag`.`sortingPriorityId` AS `tagPriority`,`ProductBrand`.`id` AS `brand`,`ProductSku`.`productSizeId` AS `size`,(case when isnull(`ProductHasProductColorGroup`.`productColorGroupId`) then 1 else `ProductHasProductColorGroup`.`productColorGroupId` end) AS `color`,`ProductHasProductCategory`.`productCategoryId` AS `category`,`ProductCategory`.`lft` AS `lft`,max(`ProductSku`.`stockQty`) AS `maxQty`,`Product`.`creationDate` AS `creation` from (((((((((`Product` join `Tag`) join `ProductStatus`) join `ProductSku`) join `ProductHasTag`) join `ProductBrand`) join `ProductSize`) join `ProductCategory`) join `ProductHasProductCategory`) left join `ProductHasProductColorGroup` on(((`Product`.`id` = `ProductHasProductColorGroup`.`productId`) and (`Product`.`productVariantId` = `ProductHasProductColorGroup`.`productVariantId`)))) where ((`ProductHasTag`.`productId` = `Product`.`id`) and (`ProductHasTag`.`productVariantId` = `Product`.`productVariantId`) and (`Product`.`productStatusId` = `ProductStatus`.`id`) and (`ProductStatus`.`isVisible` = 1) and (`ProductHasTag`.`tagId` = `Tag`.`id`) and (`Product`.`id` = `ProductSku`.`productId`) and (`ProductSku`.`price` > 0) and (`Product`.`productVariantId` = `ProductSku`.`productVariantId`) and (`ProductBrand`.`id` = `Product`.`productBrandId`) and (`ProductSize`.`id` = `ProductSku`.`productSizeId`) and (`ProductHasProductCategory`.`productId` = `Product`.`id`) and (`ProductHasProductCategory`.`productVariantId` = `Product`.`productVariantId`) and (`ProductCategory`.`id` = `ProductHasProductCategory`.`productCategoryId`) and (`ProductCategory`.`id` <> 1)) group by `Product`.`id`,`Product`.`productVariantId`,`ProductHasProductCategory`.`productCategoryId`,`ProductSku`.`price`,`Tag`.`id` having ((`maxQty` > 0) and (`ProductSku`.`price` > 0)) order by `Tag`.`sortingPriorityId`,`Product`.`sortingPriorityId`;

-- Dump della struttura di vista vRepairNestedSet
-- Rimozione temporanea di tabella e creazione della struttura finale della vista
CREATE ALGORITHM=UNDEFINED DEFINER=`redpanda`@`95.227.121.16` SQL SECURITY DEFINER VIEW `vRepairNestedSet` AS select `p`.`id` AS `pid`,`p`.`slug` AS `pname`,`c`.`id` AS `cid`,`c`.`slug` AS `cname` from (`TestNs` `c` left join `TestNs` `p` on((`p`.`lft` = (select max(`l`.`lft`) from `TestNs` `l` where ((`c`.`lft` > `l`.`lft`) and (`c`.`lft` < `l`.`rght`)))))) order by `p`.`lft`,`c`.`lft`;

