6078_workerActivty #2130

Merged
sergiodt merged 7 commits from 6078_workerActivty into dev 2024-03-14 05:58:14 +00:00
2 changed files with 19 additions and 20 deletions
Showing only changes of commit cf181521d6 - Show all commits

View File

@ -11,12 +11,18 @@
"id": true, "id": true,
"type": "number" "type": "number"
}, },
"workerActivityTypeFk": {
"type": "string"
},
"created": { "created": {
"type": "date" "type": "date"
}, },
"model": {
"type": "string"
},
"event": {
"type": "string"
},
"description": {
"type": "string"
},
"relations": { "relations": {
"workerFk": { "workerFk": {
"type": "belongsTo", "type": "belongsTo",

View File

@ -4,22 +4,6 @@ CREATE OR REPLACE TABLE `workerActivityType` (
PRIMARY KEY (`code`) PRIMARY KEY (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
CREATE OR REPLACE TABLE `workerActivity` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`workerFk` int(10) unsigned NOT NULL,
`workerActivityTypeFk` varchar(20) NOT NULL,
`created` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`),
KEY `workerActivity_worker_FK` (`workerFk`),
KEY `workerActivity_workerActivityType_FK` (`workerActivityTypeFk`),
CONSTRAINT `workerActivity_workerActivityType_FK` FOREIGN KEY (`workerActivityTypeFk`) REFERENCES `workerActivityType` (`code`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `workerActivity_worker_FK` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='Registros actividades por los trabajadores';
-- vn.workerMistakeType definition
ALTER TABLE vn.department ADD workerActivityTypeFk varchar(20) NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento'; ALTER TABLE vn.department ADD workerActivityTypeFk varchar(20) NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento';
ALTER TABLE vn.department ADD CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE; ALTER TABLE vn.department ADD CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
@ -38,4 +22,13 @@ INSERT INTO vn.workerActivityType (code, description) VALUES('STOP', 'PARADA');
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivityType', '*', 'READ', 'ALLOW', 'ROLE', 'production'); INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivityType', '*', 'READ', 'ALLOW', 'ROLE', 'production');
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivity', '*', '*', 'ALLOW', 'ROLE', 'production'); INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivity', '*', '*', 'ALLOW', 'ROLE', 'production');
ALTER TABLE vn.workerActivity MODIFY COLUMN event enum('open','close','insert','delete','update','refresh') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL;
ALTER TABLE vn.workerActivity MODIFY COLUMN model enum('COM','ENT','TPV','ENC','LAB','ETI','APP') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
ALTER TABLE vn.workerActivity ADD workerActivityTypeFk varchar(20) NULL;
ALTER TABLE vn.workerActivity ADD CONSTRAINT workerActivity_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;