ALTER TABLE `MarketplaceAccountHasProduct`
  ADD INDEX `fk_marketplaceAccountHasProduct_productId_productVariantId` (`productId`, `productVariantId`),
  ADD INDEX `marketplaceAccontHasProduct_isToWork_idx` (`isToWork`),
  ADD INDEX `marketplaceAccontHasProduct_hasError_idx` (`hasError`),
  ADD INDEX `marketplaceAccontHasProduct_isRevised_idx` (`isRevised`);


CREATE TABLE IF NOT EXISTS `MarketplaceAccountHasProductSku` (
  `productId` INT(10) UNSIGNED NOT NULL,
  `productVariantId` INT(10) UNSIGNED NOT NULL,
  `marketplaceId` INT(10) UNSIGNED NOT NULL,
  `marketplaceAccountId` INT(10) UNSIGNED NOT NULL,
  `productSizeId` INT(10) UNSIGNED NOT NULL,
  `marketplaceProductId` VARCHAR(50) NULL,
  `creationDate` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`productId`, `productVariantId`, `marketplaceId`, `marketplaceAccountId`, `productSizeId`),
  INDEX `fk_MarketplaceAccountHasProduct_has_ProductSku_ProductSku1_idx` (`productSizeId` ASC),
  INDEX `fk_MarketplaceAccountHasProduct_has_ProductSku_MarketplaceA_idx` (`productId` ASC, `productVariantId` ASC, `marketplaceId` ASC, `marketplaceAccountId` ASC),
  CONSTRAINT `fk_MarketplaceAccountHasProduct_has_ProductSku_MarketplaceAcc1`
  FOREIGN KEY (`productId` , `productVariantId` , `marketplaceId` , `marketplaceAccountId`)
  REFERENCES `MarketplaceAccountHasProduct` (`productId` , `productVariantId` , `marketplaceId` , `marketplaceAccountId`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT `fk_MarketplaceAccountHasProduct_has_ProductSku_ProductSku1`
  FOREIGN KEY (`productSizeId`)
  REFERENCES `ProductSku` (`productSizeId`)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
  ENGINE = InnoDB
  DEFAULT CHARACTER SET = utf8;

ALTER TABLE `MarketplaceAccountHasProductSku`
  ADD INDEX `MarketplaceAccountHasProductSku_marketplaceProductId_idx` (`marketplaceProductId`);

ALTER TABLE `MarketplaceAccountHasProduct`
  ADD INDEX `MarketplaceAccountHasProductSku_marketplaceProductId_idx` (`marketplaceProductId`);

ALTER TABLE `MarketplaceAccountCategory`
  CHANGE COLUMN `etc` `config` TEXT NULL AFTER `isRelevant`;