-- Place your SQL code here
CREATE TABLE IF NOT EXISTS `vn`.`itemSoldOutTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` varchar(50) NOT 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`.`itemSoldOutTag` (`name`) VALUES ('Ultimas unidades');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Temporalmente');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Descatalogado');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta mayo');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta febrero');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta diciembre');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta enero');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta marzo');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta nueva temporada');
INSERT IGNORE INTO `vn`.`itemSoldOutTag` (`name`) VALUES ('Hasta septiembre');

UPDATE vn.tag
	SET isFree=FALSE,
		sourceTable='itemSoldOutTag'
	WHERE name= 'Agotado';


CREATE TABLE IF NOT EXISTS `vn`.`itemDurationTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` varchar(50) NOT 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`.`itemDurationTag` (`name`) VALUES ('10 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('11 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('12 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('13 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('14 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('15 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('17 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('7 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('9 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('16-20 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('17-21 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('19-23 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('3-4 semanas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('13-17 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('14-16 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('15-19 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('18-25 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('20 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('6 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('9 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('10-13 días');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('6 meses');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('5 años');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('10 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('20 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('35 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('6 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('11 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('12 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('14 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('15 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('18 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('19 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('24 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('25 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('30 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('32 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('4 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('40 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('45 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('50 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('55 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('70 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('8 horas');
INSERT IGNORE INTO `vn`.`itemDurationTag` (`name`) VALUES ('9 horas');

UPDATE vn.tag
	SET isFree=FALSE,
		sourceTable='itemDurationTag'
	WHERE name= 'Duracion';


CREATE TABLE IF NOT EXISTS `vn`.`itemGrowingTag` (
	`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
	`name` varchar(50) NOT 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`.`itemGrowingTag` (`name`) VALUES ('01-05');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-06');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('02-06');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('03-05');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('03-07');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('03-08');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('03-11');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('04-06');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('04-09');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('04-11');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('05-07');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('05-08');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('05-10');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('05-11');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('06-09');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('06-10');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('06-11');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('07-09');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('07-10');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('07-11');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('07-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('09-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-04 / 10-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-04 / 9-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-05 / 10-12');
INSERT IGNORE INTO `vn`.`itemGrowingTag` (`name`) VALUES ('01-05 / 11-12');

UPDATE vn.tag
	SET isFree=FALSE,
		sourceTable='itemGrowingTag'
	WHERE name= 'Recolecta';

GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemSoldOutTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemDurationTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemGrowingTag TO logisticAssist;
