32 lines
1.7 KiB
SQL
32 lines
1.7 KiB
SQL
CREATE TABLE vn.workerShelving (
|
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
`workerFk` int(11) NOT NULL,
|
|
`shelvingFk` varchar(10) CHARACTER SET utf8 NOT NULL,
|
|
`collectionFk` int(11) DEFAULT NULL,
|
|
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
PRIMARY KEY (`id`),
|
|
KEY `workerShelving_shelving_fk` (`shelvingFk`),
|
|
KEY `workerShelving_FK` (`workerFk`),
|
|
KEY `workerShelving_FK_1` (`collectionFk`),
|
|
CONSTRAINT `workerShelving_worker_fk` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`),
|
|
CONSTRAINT `workerShelving_collection_fk` FOREIGN KEY (`collectionFk`) REFERENCES `collection` (`id`),
|
|
CONSTRAINT `workerShelving_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='utilizaremos el id para establecer la prioridad de los carros a asignar';
|
|
|
|
CREATE TABLE `smartTag` (
|
|
`code` varchar(12) CHARACTER SET utf8 NOT NULL,
|
|
`shelvingFk` varchar(10) CHARACTER SET utf8 DEFAULT NULL,
|
|
`level` int(11) DEFAULT NULL,
|
|
`ticketFk` int(11) DEFAULT NULL,
|
|
KEY `ticket_fk` (`ticketFk`),
|
|
KEY `smartTag_shelving_fk` (`shelvingFk`),
|
|
CONSTRAINT `smartTag_shelving_fk` FOREIGN KEY (`shelvingFk`) REFERENCES `shelving` (`code`) ON UPDATE CASCADE,
|
|
CONSTRAINT `smartTag_ticket_fk` FOREIGN KEY (`ticketFk`) REFERENCES `ticketCollection` (`ticketFk`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
|
|
|
--ALTER TABLE vn.smartTag MODIFY COLUMN shelvingFk varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL NULL;
|
|
--ALTER TABLE vn.smartTag ADD CONSTRAINT smartTag_FK FOREIGN KEY (shelvingFk) REFERENCES vn.shelving(code);
|
|
|
|
|
|
|