CREATE TABLE IF NOT EXISTS `vn`.`itemFarmingTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT IGNORE INTO `vn`.`itemFarmingTag` (`name`) VALUES ('Enraizado');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemFarmingTag'
	WHERE name= 'cultivo';

CREATE TABLE IF NOT EXISTS `vn`.`itemWrappingTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Bolsa');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja cartón');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja decorativa');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Celofán');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Papel kraft');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Variable');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemWrappingTag'
	WHERE name= 'Envoltorio';

CREATE TABLE IF NOT EXISTS `vn`.`itemLanguageTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
	
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Castellano');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Catalán');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Euskera');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Francés');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Gallego');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Inglés');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Portugués');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemLanguageTag'
	WHERE name= 'Idioma';

CREATE TABLE IF NOT EXISTS `vn`.`itemStemTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Natural');
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Seminatural');
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Sintético');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemStemTag'
	WHERE name= 'Tronco';


CREATE TABLE IF NOT EXISTS `vn`.`itemBreederTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT IGNORE INTO `vn`.`itemBreederTag` (`name`) VALUES ('David Austin');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemBreederTag'
	WHERE name= 'Obtentor';

CREATE TABLE IF NOT EXISTS `vn`.`itemBaseTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
	
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Biodegradable');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Caballete');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cerámica');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cristal');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico por inyección');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Madera');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Rígido');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Ruedas');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Sin soporte rígido');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemBaseTag'
	WHERE name= 'Soporte';

CREATE TABLE IF NOT EXISTS `vn`.`itemVatRateTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
	`name` varchar(50) DEFAULT NULL, 
	PRIMARY KEY (`id`), 
	UNIQUE KEY `name_UNIQUE` (`name`) 
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT 
	CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;

INSERT IGNORE INTO `vn`.`itemVatRateTag` (`name`) VALUES ('General');
INSERT IGNORE INTO `vn`.`itemVatRateTag` (`name`) VALUES ('Reducido');

UPDATE vn.tag 
	SET isFree=0, 
		sourceTable='itemVatRateTag'
	WHERE name= 'Tipo de IVA';	

GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemFarmingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemLanguageTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemStemTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBaseTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBreederTag TO logisticAssist;