6078_workerActivty #2130
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue