31 lines
1.5 KiB
MySQL
31 lines
1.5 KiB
MySQL
|
USE `vn`;
|
||
|
DROP VIEW IF EXISTS vn.comparativeFilter;
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS vn.`comparativeFilter` (
|
||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||
|
`userFk` int(10) unsigned NOT NULL,
|
||
|
`name` varchar(100) COLLATE utf8mb3_unicode_ci NOT NULL,
|
||
|
`buyer` int(11) DEFAULT NULL,
|
||
|
`itemFilter` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||
|
`isFloramondo` tinyint(4) DEFAULT NULL,
|
||
|
`warehouseFk` smallint(6) unsigned DEFAULT NULL,
|
||
|
`tintaFk` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||
|
`hasType` tinyint(1) DEFAULT 0,
|
||
|
`producerFilter` varchar(255) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||
|
`supplierFk` int(11) DEFAULT NULL,
|
||
|
PRIMARY KEY (`id`),
|
||
|
KEY `comparativeFilter_FK` (`userFk`),
|
||
|
KEY `comparativeFilter_FK_1` (`warehouseFk`),
|
||
|
KEY `comparativeFilter_FK_2` (`supplierFk`),
|
||
|
CONSTRAINT `comparativeFilter_FK` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`),
|
||
|
CONSTRAINT `comparativeFilter_FK_1` FOREIGN KEY (`warehouseFk`) REFERENCES `warehouse` (`id`),
|
||
|
CONSTRAINT `comparativeFilter_FK_2` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`)
|
||
|
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||
|
|
||
|
CREATE TABLE IF NOT EXISTS vn.`comparativeFilterType` (
|
||
|
`comparativeFilterFk` int(11) NOT NULL,
|
||
|
`itemTypeFk` int(11) NOT NULL,
|
||
|
PRIMARY KEY (`comparativeFilterFk`,`itemTypeFk`),
|
||
|
CONSTRAINT `comparativeFilterType_FK` FOREIGN KEY (`comparativeFilterFk`) REFERENCES `comparativeFilter` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|