CREATE TABLE `ProductStatistics` (
  `productId` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `shopId` INT(10) UNSIGNED NOT NULL,
  `qty` INT(10) UNSIGNED NOT NULL,
  `isVisible` TINYINT UNSIGNED NOT NULL,
  `hasDetails` TINYINT UNSIGNED NOT NULL,
  `hasPhotos` TINYINT UNSIGNED NOT NULL,
  `hasPrices` TINYINT UNSIGNED NOT NULL,
  `isOnSale` TINYINT UNSIGNED NOT NULL,
  `date` DATE NOT NULL,
  PRIMARY KEY (`productId`, `productVariantId`, `shopId`, `date`),
  CONSTRAINT `fk_ProductStatistics_shopHasProduct` FOREIGN KEY
    (`productId`, `productVariantId`, `shopId`) REFERENCES
    `ShopHasProduct` (`productId`, `productVariantId`, `shopId`)
);