salix/db/changes/240201/00-locker.sql

34 lines
1.4 KiB
MySQL
Raw Normal View History

2023-12-26 12:44:52 +00:00
ALTER TABLE vn.worker MODIFY COLUMN locker varchar(10) DEFAULT NULL NULL;
2023-10-11 11:26:27 +00:00
CREATE TABLE `vn`.`locker` (
2023-10-17 11:08:00 +00:00
`code` varchar(10) DEFAULT NULL,
2023-10-11 11:26:27 +00:00
`gender` varchar(255) DEFAULT NULL,
`workerFk` int(10) unsigned DEFAULT NULL,
PRIMARY KEY (`code`),
UNIQUE KEY `code` (`code`),
KEY `workerFk` (`workerFk`),
CONSTRAINT `locker_ibfk_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
2023-12-26 12:44:52 +00:00
ALTER TABLE `vn`.`worker`
ADD CONSTRAINT `worker_locker_fk`
FOREIGN KEY (`locker`)
REFERENCES `vn`.`locker` (`code`)
ON UPDATE CASCADE
ON DELETE SET NULL;
2023-10-11 11:26:27 +00:00
-- Insertar taquillas disponibles para mujeres (1A - 73A / 1B - 73B)
INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
('1A', 'M', NULL), ('2A', 'M', NULL), ('3A', 'M', NULL), ('4A', 'M', NULL), ('5A', 'M', NULL), ('6A', 'M', NULL), ('7A', 'M', NULL),
('1B', 'M', NULL), ('2B', 'M', NULL), ('3B', 'M', NULL), ('4B', 'M', NULL), ('5B', 'M', NULL), ('6B', 'M', NULL), ('7B', 'M', NULL);
-- Insertar taquillas disponibles para mujeres (200A - 217A / 200B - 217B)
INSERT INTO `vn`.`locker` (code, gender, workerFk) VALUES
('200A', 'F', NULL), ('201A', 'F', NULL), ('202A', 'F', NULL), ('203A', 'F', NULL), ('204A', 'F', NULL), ('205A', 'F', NULL), ('206A', 'F', NULL),
('200B', 'F', NULL), ('201B', 'F', NULL), ('202B', 'F', NULL), ('203B', 'F', NULL), ('204B', 'F', NULL), ('205B', 'F', NULL), ('206B', 'F', NULL);
2023-10-17 11:08:00 +00:00
2023-12-26 12:44:52 +00:00