
CREATE TABLE `extraorderitem`(
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `orderId` int(10) unsigned NOT NULL default 0,
  `orderItemId` int(10) unsigned NOT NULL default 0,
  `productId` int(10) unsigned NOT NULL default 0,
  `quantity` double(10,4) unsigned NOT NULL default 0.0000,
  `qtyInKit` double(10,4) unsigned NOT NULL default 0.0000,
  `unitPrice` double(10,4) unsigned NOT NULL default 0.0000,
  `unitPriceExGST`  double(10,4) unsigned NOT NULL default 0.0000,
  `discount` double(5,2) NOT NULL default 0.00,
  `totalPrice` double(14,4) unsigned NOT NULL default 0.0000,
  `isOrdered` tinyint(1) NOT NULL default 0,
  `eta` datetime  default NULL,
  `margin` double(10,4) NOT NULL default 0.0000,
  `unitCost` double(10,4) NOT NULL default 0.0000,
  `taxFree` tinyint(1) NOT NULL default 0,
  `active` tinyint(1) NOT NULL DEFAULT '1',
  `created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
  `createdById` int(10) unsigned NOT NULL DEFAULT '0',
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `updatedById` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `orderId` (`orderId`) USING BTREE,
  KEY `orderItemId` (`orderItemId`) USING BTREE,
  KEY `productId` (`productId`) USING BTREE,
  KEY `quantity` (`quantity`) USING BTREE,
  KEY `qtyInKit` (`qtyInKit`) USING BTREE,
  KEY `unitPrice` (`unitPrice`) USING BTREE,
  KEY `unitPriceExGST` (`unitPriceExGST`) USING BTREE,
  KEY `discount` (`discount`) USING BTREE,
  KEY `totalPrice` (`totalPrice`) USING BTREE,
  KEY `isOrdered` (`isOrdered`) USING BTREE,
  KEY `eta` (`eta`) USING BTREE,
  KEY `margin` (`margin`) USING BTREE,
  KEY `unitCost` (`unitCost`) USING BTREE,
  KEY `taxFree` (`taxFree`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;


ALTER TABLE `sellingitem` ADD COLUMN `extraorderitemId` int(10) unsigned DEFAULT NULL AFTER `orderItemId`;
CREATE INDEX `extraorderitemId` ON `sellingitem`(`extraorderitemId`) USING BTREE;

ALTER TABLE `sellingitem`
MODIFY `orderItemId` int(10) unsigned DEFAULT NULL;
