#9746 update structure db

This commit is contained in:
Bernat 2019-02-05 10:48:33 +01:00
parent 7ce54d223a
commit b2dc6ce8c6
4 changed files with 12 additions and 51 deletions

View File

@ -38,7 +38,7 @@
"Vehicle": { "Vehicle": {
"dataSource": "vn" "dataSource": "vn"
}, },
"UserTableConfiguration": { "UserConfigView": {
"dataSource": "vn" "dataSource": "vn"
} }
} }

View File

@ -1,9 +1,9 @@
{ {
"name": "UserTableConfiguration", "name": "UserConfigView",
"base": "VnModel", "base": "VnModel",
"options": { "options": {
"mysql": { "mysql": {
"table": "salix.userTableConfiguration" "table": "salix.userConfigView"
} }
}, },
"properties": { "properties": {

View File

@ -0,0 +1,9 @@
CREATE TABLE `salix`.`userConfigView` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`userFk` int(10) unsigned NOT NULL,
`tableCode` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`configuration` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
UNIQUE KEY `uniqueUser_TableCode` (`userFk`,`tableCode`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1,48 +0,0 @@
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;
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;