diff --git a/back/model-config.json b/back/model-config.json index 7a7b7af56..0a0772b04 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -38,7 +38,7 @@ "Vehicle": { "dataSource": "vn" }, - "UserTableConfiguration": { + "UserConfigView": { "dataSource": "vn" } } diff --git a/back/models/user-table-configuration.json b/back/models/user-config-view.json similarity index 85% rename from back/models/user-table-configuration.json rename to back/models/user-config-view.json index 4a35f66cf..1cb933079 100644 --- a/back/models/user-table-configuration.json +++ b/back/models/user-config-view.json @@ -1,9 +1,9 @@ { - "name": "UserTableConfiguration", + "name": "UserConfigView", "base": "VnModel", "options": { "mysql": { - "table": "salix.userTableConfiguration" + "table": "salix.userConfigView" } }, "properties": { diff --git a/services/db/install/changes/1.2-CHECK/23-userConfigView.sql b/services/db/install/changes/1.2-CHECK/23-userConfigView.sql new file mode 100644 index 000000000..855b77f0f --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/23-userConfigView.sql @@ -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; diff --git a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql b/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql deleted file mode 100644 index c7212f7ba..000000000 --- a/services/db/install/changes/1.2-CHECK/23-userTableConfiguration.sql +++ /dev/null @@ -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;