From 2cd2c6bdaeb6a76df5bf1f9ce8615029610863c1 Mon Sep 17 00:00:00 2001 From: Bernat Date: Fri, 21 Sep 2018 07:28:26 +0200 Subject: [PATCH] update model agency --- .../db/install/changes/1.1.0/06-agency.sql | 2 ++ .../db/install/changes/1.1.0/07.viewAgency.sql | 18 ++++++++++++++++++ services/loopback/common/models/agency.json | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 services/db/install/changes/1.1.0/06-agency.sql create mode 100644 services/db/install/changes/1.1.0/07.viewAgency.sql diff --git a/services/db/install/changes/1.1.0/06-agency.sql b/services/db/install/changes/1.1.0/06-agency.sql new file mode 100644 index 000000000..3dcfaf05d --- /dev/null +++ b/services/db/install/changes/1.1.0/06-agency.sql @@ -0,0 +1,2 @@ + ALTER TABLE `vn2008`.`agency` +ADD COLUMN `code` VARCHAR(45) NULL DEFAULT NULL AFTER `zone_label`; \ No newline at end of file diff --git a/services/db/install/changes/1.1.0/07.viewAgency.sql b/services/db/install/changes/1.1.0/07.viewAgency.sql new file mode 100644 index 000000000..2759983a6 --- /dev/null +++ b/services/db/install/changes/1.1.0/07.viewAgency.sql @@ -0,0 +1,18 @@ +USE `vn`; +CREATE + OR REPLACE ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `agency` AS + SELECT + `a`.`agency_id` AS `id`, + `a`.`name` AS `name`, + `a`.`warehouse_id` AS `warehouseFk`, + `a`.`por_volumen` AS `isVolumetric`, + `a`.`Id_Banco` AS `bankFk`, + `a`.`warehouse_alias_id` AS `warehouseAliasFk`, + `a`.`propios` AS `own`, + `a`.`zone_label` AS `labelZone`, + `a`.`code` AS `code` + FROM + `vn2008`.`agency` `a`; diff --git a/services/loopback/common/models/agency.json b/services/loopback/common/models/agency.json index 9269b3db6..fa104399c 100644 --- a/services/loopback/common/models/agency.json +++ b/services/loopback/common/models/agency.json @@ -15,6 +15,10 @@ "name": { "type": "String", "required": false + }, + "code": { + "type": "String", + "required": false } } }