refs #6078 feat:add workeractivity
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Sergio De la torre 2024-03-05 11:53:57 +01:00
parent 96abdd4630
commit cf181521d6
2 changed files with 19 additions and 20 deletions

View File

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

View File

@ -4,22 +4,6 @@ CREATE OR REPLACE TABLE `workerActivityType` (
PRIMARY KEY (`code`)
) 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 CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
@ -39,3 +23,12 @@ 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('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;