ALTER TABLE edi.ekt
	ADD batchNumber BIGINT(20) UNSIGNED NULL COMMENT 'RFF+BT' AFTER entryYear;

ALTER TABLE edi.`param` ADD UNIQUE(`code`);

INSERT IGNORE INTO edi.`param` (`id`, `code`, `name`, `subname`, `position`, `type`, `required`)
	VALUES ('0', 'batchNumber', 'RFF', 'BT', '2', 'INTEGER', '0');

ALTER TABLE edi.ekt
	MODIFY COLUMN id int(11) auto_increment NOT NULL COMMENT 'Id',
	MODIFY COLUMN barcode char(15) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL COMMENT 'Generated auction barcode',
	MODIFY COLUMN entryYear smallint(5) unsigned NOT NULL COMMENT 'Transaction year',
	MODIFY COLUMN deliveryNumber bigint(20) unsigned DEFAULT NULL NULL COMMENT 'RFF+AAJ',
	MODIFY COLUMN fec date DEFAULT NULL NULL COMMENT 'DTM+97',
	MODIFY COLUMN hor time DEFAULT NULL NULL COMMENT 'UNB',
	MODIFY COLUMN now timestamp DEFAULT current_timestamp() NULL COMMENT 'Creation time',
	MODIFY COLUMN ptj mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'NAD+BY',
	MODIFY COLUMN `ref` int(11) NOT NULL COMMENT 'LIN',
	MODIFY COLUMN item varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL COMMENT 'IMD+S99',
	MODIFY COLUMN pac int(11) DEFAULT 0 NULL COMMENT 'QTY+52',
	MODIFY COLUMN qty int(10) NOT NULL COMMENT 'QTY+66',
	MODIFY COLUMN ori varchar(3) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT 'NL' NULL COMMENT 'IMD+S62',
	MODIFY COLUMN cat varchar(2) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL COMMENT 'IMD+S98',
	MODIFY COLUMN agj int(11) DEFAULT NULL NULL COMMENT 'RFF+AGJ',
	MODIFY COLUMN kop int(11) DEFAULT NULL NULL COMMENT 'RFF+ADZ',
	MODIFY COLUMN ptd varchar(6) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL COMMENT 'RFF+ACE',
	MODIFY COLUMN sub mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'RFF+CTS',
	MODIFY COLUMN pro mediumint(8) unsigned NOT NULL COMMENT 'NAD+MF',
	MODIFY COLUMN pri double NOT NULL COMMENT 'PRI+INV',
	MODIFY COLUMN package int(10) unsigned DEFAULT NULL NULL COMMENT 'PAC',
	MODIFY COLUMN auction smallint(5) unsigned DEFAULT NULL NULL COMMENT 'NAD+FLA',
	MODIFY COLUMN klo smallint(5) unsigned DEFAULT NULL NULL COMMENT 'RFF+FAC',
	MODIFY COLUMN k1 smallint(5) unsigned DEFAULT NULL NULL COMMENT 'IMD+K01',
	MODIFY COLUMN k2 smallint(5) unsigned DEFAULT NULL NULL COMMENT 'IMD+K02',
	MODIFY COLUMN putOrderFk bigint(20) unsigned DEFAULT NULL NULL COMMENT 'RFF+ON',
	MODIFY COLUMN scanned tinyint(1) DEFAULT 0 NOT NULL COMMENT 'Whether it''s been scanned';
