#9699 update structure and create new model

This commit is contained in:
Bernat 2019-02-04 07:42:12 +01:00
parent 84c0002cb1
commit e1207edb95
3 changed files with 51 additions and 0 deletions

View File

@ -37,6 +37,9 @@
},
"Vehicle": {
"dataSource": "vn"
},
"UserTableConfiguration": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,30 @@
{
"name": "UserTableConfiguration",
"base": "VnModel",
"options": {
"mysql": {
"table": "salix.userTableConfiguration"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"required": true
},
"tableCode": {
"type": "String",
"required": true
},
"configuration": {
"type": "String"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}

View File

@ -0,0 +1,18 @@
CREATE TABLE `salix`.`userTableConfiguration` (
`id` INT NOT NULL AUTO_INCREMENT,
`workerFk` INT(11) NOT NULL,
`tableCode` VARCHAR(255) NOT NULL,
`configuration` TEXT NULL,
PRIMARY KEY (`id`));
ALTER TABLE `salix`.`userTableConfiguration`
ADD INDEX `fgn_worker_idx` (`workerFk` ASC);
ALTER TABLE `salix`.`userTableConfiguration`
ADD CONSTRAINT `fgn_worker`
FOREIGN KEY (`workerFk`)
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
ON DELETE CASCADE
ON UPDATE CASCADE;