update structure db #9764

This commit is contained in:
Bernat 2019-02-05 09:49:33 +01:00
parent 8f575fbc45
commit 2c9a10f277
2 changed files with 33 additions and 3 deletions

View File

@ -21,10 +21,10 @@
}
},
"relations": {
"worker": {
"user": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
"model": "Account",
"foreignKey": "userFk"
}
}
}

View File

@ -16,3 +16,33 @@ ADD CONSTRAINT `fgn_worker`
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `salix`.`userTableConfiguration`
DROP FOREIGN KEY `fgn_worker`;
ALTER TABLE `salix`.`userTableConfiguration`
CHANGE COLUMN `workerFk` `userFk` INT(10) NOT NULL ;
ALTER TABLE `salix`.`userTableConfiguration`
ADD CONSTRAINT `fgn_worker`
FOREIGN KEY (`userFk`)
REFERENCES `vn2008`.`Trabajadores` (`Id_Trabajador`)
ON DELETE CASCADE
ON UPDATE CASCADE;
ALTER TABLE `salix`.`userTableConfiguration`
DROP FOREIGN KEY `fgn_worker`;
ALTER TABLE `salix`.`userTableConfiguration`
DROP INDEX `fgn_worker_idx` ;
ALTER TABLE `salix`.`userTableConfiguration`
CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NOT NULL ;
ALTER TABLE `salix`.`userTableConfiguration`
ADD INDEX `fgn_user_idx` (`userFk` ASC);
ALTER TABLE `salix`.`userTableConfiguration`
ADD CONSTRAINT `fgn_user`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;