INSERT INTO OrderStatus (id,code, title, description, nextOrderStatusId, errOrderStatusId, `order`, color) VALUES (16, 'TRN', 'Transaction', 'Cart is being trasformed in Order', 3, 1, 1, '#00FF00');
UPDATE `Order` o set status = 'CRT_MRG' where status = 'MRG';

ALTER TABLE `Order`
  ADD CONSTRAINT `fk_Order_userId_User_id` FOREIGN KEY (`userId`) REFERENCES `User` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION,
  ADD CONSTRAINT `fk_Order_status_OrderStatus_code` FOREIGN KEY (`status`) REFERENCES `OrderStatus` (`code`) ON UPDATE NO ACTION ON DELETE NO ACTION,
  add COLUMN marketplaceId INT(10) unsigned null after userId,
  add COLUMN marketplaceAccountId INT(10) unsigned null after marketplaceId,
  add COLUMN sellingFee DOUBLE not null default 0 after vat,
  add COLUMN customModifier DOUBLE not null DEFAULT 0 after sellingFee,
  ADD INDEX `marketplaceId_marketplaceAccountId` (`marketplaceId`, `marketplaceAccountId`),
  ADD CONSTRAINT `fk_order_marketplaceAccount_ids` FOREIGN KEY (`marketplaceId`, `marketplaceAccountId`) REFERENCES `MarketplaceAccount` (`id`, `marketplaceId`) ON UPDATE NO ACTION ON DELETE NO ACTION;

ALTER TABLE `OrderLine`
  ADD COLUMN `sellingFeeCharge` DOUBLE NULL DEFAULT NULL AFTER `paymentCharge`,
  ADD COLUMN `customModifierCharge` DOUBLE NULL DEFAULT NULL AFTER `sellingFeeCharge`;
