INSERT INTO vn.arcRead (id, printerFk, ip, counter, error, minimum) VALUES(1, NULL, '10.1.16.1', 17, NULL, 5);

CREATE TABLE `rfidTest` (
  `palletFk` int(11) DEFAULT NULL,
  `expeditionFk` int(11) DEFAULT NULL,
  `created` timestamp NULL DEFAULT current_timestamp(),
  `peakRssi` int(11) DEFAULT NULL,
  `antenna` int(11) DEFAULT NULL,
  `attempt` int(11) DEFAULT NULL,
  `power` int(11) DEFAULT NULL,
  `sensitivity` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;


CREATE TABLE `algorithm` (
  `palletFk` int(11) DEFAULT NULL,
  `expeditionArray` text DEFAULT NULL,
  `created` timestamp NULL DEFAULT current_timestamp(),
  `expeditionCount` int(11) DEFAULT NULL,
  `model` text DEFAULT NULL,
  `attempt` int(11) DEFAULT NULL,
  `power` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;



-- vn.trys definition

-- vn.trys definition

CREATE TABLE `vn`.`trys` (
  `palletFk` int(11) NOT NULL,
  `missing` text DEFAULT NULL,
  `powerType` varchar(255) NOT NULL DEFAULT 'V17',
  `extra` varchar(100) DEFAULT NULL,
  `antennaReads` text DEFAULT NULL,
  `observationExtra` text DEFAULT NULL,
  `observationMissing` text DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT current_timestamp(),
  `antenna1` int(11) DEFAULT NULL,
  `antenna2` int(11) DEFAULT NULL,
  `antenna3` int(11) DEFAULT NULL,
  `antenna4` int(11) DEFAULT NULL,
  `total` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`palletFk`,`powerType`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;


CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`trys_beforeUpdate`
	BEFORE UPDATE ON `trys`
	FOR EACH ROW
BEGIN
	IF (NEW.missing > OLD.missing) THEN
		CALL util.throw('New missing greater than old');
	END IF;
END
-- powerTypes [PW13, PW15, V17, V19]