USE `vn`;

DROP TABLE IF EXISTS vn.splitFilter;
CREATE TABLE `vn`.`splitFilter` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `autonomyFk` int(11) DEFAULT NULL,
  `clientFk` int(11) DEFAULT NULL,
  `nickname` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `splitFilter_UN` (`autonomyFk`),
  UNIQUE KEY `splitFilter_UN1` (`clientFk`),
  KEY `splitFilter_FK` (`autonomyFk`),
  KEY `splitFilter_FK_1` (`clientFk`),
  CONSTRAINT `splitFilter_FK` FOREIGN KEY (`autonomyFk`) REFERENCES `autonomy` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  CONSTRAINT `splitFilter_FK_1` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='define los clientes que tienen split y el nombre a mostrar en la etiqueta';

INSERT INTO vn.splitFilter
(id, autonomyFk, clientFk, nickname)
VALUES(1, 7, NULL, '<<VILASSAR>>');

INSERT INTO vn.splitFilter
(id, autonomyFk, clientFk, nickname)
VALUES(2, NULL, 93, 'DIONI');
