diff --git a/Jenkinsfile b/Jenkinsfile index 4914f8f1c..5d2ae55a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,19 +32,6 @@ pre: { // https://loopback.io/doc/en/lb3/Setting-debug-strings.html#debug-strings-reference //env.DEBUG = 'strong-remoting:shared-method' } -node { - stage('Setup') { - def packageJson = readJSON file: 'package.json' - env.VERSION = packageJson.version - - env.GIT_COMMIT_MSG = sh( - script: 'git log -1 --pretty=%B ${GIT_COMMIT}', - returnStdout: true - ).trim() - - setEnv() - } -} pipeline { agent any options { @@ -115,6 +102,10 @@ pipeline { CREDENTIALS = credentials('docker-registry') } steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + } sh 'gulp build' dockerBuild() } @@ -145,6 +136,10 @@ pipeline { DOCKER_HOST = "${env.SWARM_HOST}" } steps { + script { + def packageJson = readJSON file: 'package.json' + env.VERSION = packageJson.version + } sh "docker stack deploy --with-registry-auth --compose-file docker-compose.yml ${env.STACK_NAME}" } } @@ -167,6 +162,11 @@ pipeline { success { script { if (env.BRANCH_NAME == 'master' && FROM_GIT) { + env.GIT_COMMIT_MSG = sh( + script: 'git log -1 --pretty=%B ${GIT_COMMIT}', + returnStdout: true + ).trim() + String message = env.GIT_COMMIT_MSG int index = message.indexOf('\n') if (index != -1) @@ -183,6 +183,7 @@ pipeline { } } unsuccessful { + setEnv() sendEmail() } } diff --git a/db/dump/fixtures.after.sql b/db/dump/fixtures.after.sql index 57ccb8626..489234089 100644 --- a/db/dump/fixtures.after.sql +++ b/db/dump/fixtures.after.sql @@ -30,7 +30,7 @@ INSERT INTO vn.buy (id,entryFk,itemFk,quantity,dispatched,buyingValue,freightVal (18,10,15,500,0,55.0,1.0,0,1,1,1,0,0.0,1.0,'5',0.0,78.3,75.6,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5), (19,10,11,5000,0,50.0,1.0,0,1,1,1,1,0.0,1.0,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5); */ -INSERT INTO vn2008.Splits (Id_Split,Id_Ticket,Id_Entrada,Fecha,Notas) +INSERT INTO vn.split (id,ticketFk,entryFk,dated,note) VALUES (1,7,2,'00-00-0000 00:00:00.000','nota1'), (2,10,6,'00-00-0000 00:00:00.000','nota2'), diff --git a/db/routines/bi/procedures/analisis_ventas_update.sql b/db/routines/bi/procedures/analisis_ventas_update.sql index 04f9b6483..4f6a448ed 100644 --- a/db/routines/bi/procedures/analisis_ventas_update.sql +++ b/db/routines/bi/procedures/analisis_ventas_update.sql @@ -47,7 +47,7 @@ BEGIN LEFT JOIN vn.deliveryMethod dm ON dm.id = a.Vista LEFT JOIN vn2008.Consignatarios cs ON cs.Id_Consigna = t.Id_Consigna LEFT JOIN vn2008.province p ON p.province_id = cs.province_id - LEFT JOIN vn2008.warehouse w ON w.id = t.warehouse_id + LEFT JOIN vn.warehouse w ON w.id = t.warehouse_id WHERE bt.fecha >= vLastMonth AND r.mercancia; END$$ DELIMITER ; diff --git a/db/routines/edi/procedures/ekt_load.sql b/db/routines/edi/procedures/ekt_load.sql index 920226693..ccdcd1999 100644 --- a/db/routines/edi/procedures/ekt_load.sql +++ b/db/routines/edi/procedures/ekt_load.sql @@ -22,6 +22,7 @@ proc:BEGIN DECLARE vHasItemGroup BOOL; DECLARE vDescription VARCHAR(255); DECLARE vSaleFk INT; + DECLARE vDefaultEntry INT; -- Carga los datos necesarios del EKT SELECT e.ref, qty, package, putOrderFk MOD 1000000, i2.id , NOT ISNULL(eea.addressFk), NOT ISNULL(igto.group_code), @@ -41,6 +42,9 @@ proc:BEGIN CALL vn.mail_insert('pako@verdnatura.es', 'nocontestar@verdnatura.es', CONCAT('Nuevo grupo en Floramondo: ', vDescription), vDescription); LEAVE proc; END IF; + + SELECT defaultEntry INTO vDefaultEntry + FROM vn.entryConfig; -- Asigna la entrada SELECT vn.ekt_getEntry(vSelf) INTO vEntryFk; @@ -100,10 +104,9 @@ proc:BEGIN LEFT JOIN ekt l ON l.ref = e.ref LEFT JOIN vn.buy b ON b.ektFk = l.id LEFT JOIN vn.item i ON i.id = b.itemFk - JOIN vn2008.config cfg WHERE e.id = vSelf AND l.id != vSelf - AND b.itemFk != cfg.generic_item + AND b.itemFk != vDefaultEntry AND IF(t.s1, l.s1 = e.s1, TRUE) AND IF(t.s2, l.s2 = e.s2, TRUE) AND IF(t.s3, l.s3 = e.s3, TRUE) @@ -142,7 +145,7 @@ proc:BEGIN SELECT vEntryFk, vSelf, (@t := IF(i.stems, i.stems, 1)) * e.pri / IFNULL(i.stemMultiplier, 1) buyingValue, - IFNULL(vItem, cfg.generic_item) itemFk, + IFNULL(vItem, vDefaultEntry) itemFk, e.qty stickers, @pac := IFNULL(i.stemMultiplier, 1) * e.pac / @t packing, IFNULL(b.`grouping`, e.pac), @@ -153,8 +156,7 @@ proc:BEGIN FROM ekt e LEFT JOIN vn.buy b ON b.id = vBuy LEFT JOIN vn.item i ON i.id = b.itemFk - LEFT JOIN vn.supplier s ON e.pro = s.id - JOIN vn2008.config cfg + LEFT JOIN vn.supplier s ON e.pro = s.id WHERE e.id = vSelf LIMIT 1; diff --git a/db/routines/edi/procedures/ekt_scan.sql b/db/routines/edi/procedures/ekt_scan.sql index 456e329e0..b0b75a6a7 100644 --- a/db/routines/edi/procedures/ekt_scan.sql +++ b/db/routines/edi/procedures/ekt_scan.sql @@ -2,7 +2,7 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `edi`.`ekt_scan`(vBarcode VARCHAR(512)) BEGIN /** - * Busca transaciones a partir de un código de barras, las marca como escaneadas + * Busca transaciones a partir de un codigo de barras, las marca como escaneadas * y las devuelve. * Ver https://wiki.verdnatura.es/index.php/Ekt#Algoritmos_de_lectura * @@ -73,7 +73,7 @@ BEGIN INSERT INTO tmp.ekt SELECT id FROM ekt - WHERE fec = vFec + WHERE fec >= vFec - INTERVAL 1 DAY AND (( vKlo = vDefaultKlo AND (klo = vKlo OR klo IS NULL OR klo = 0) @@ -82,7 +82,7 @@ BEGIN AND auction = vAuction AND agj = vShortAgj) ) - ORDER BY agj DESC + ORDER BY agj DESC, fec DESC LIMIT 1; SELECT COUNT(*) FROM tmp.ekt INTO vIsFound; diff --git a/db/routines/edi/views/ektK2.sql b/db/routines/edi/views/ektK2.sql new file mode 100644 index 000000000..299d26b01 --- /dev/null +++ b/db/routines/edi/views/ektK2.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `edi`.`ektK2` +AS SELECT `eek`.`id` AS `id`, + `eek`.`description` AS `description` +FROM `edi`.`ektK1` `eek` diff --git a/db/routines/vn/procedures/buy_afterUpsert.sql b/db/routines/vn/procedures/buy_afterUpsert.sql index ed98cb595..17e84177c 100644 --- a/db/routines/vn/procedures/buy_afterUpsert.sql +++ b/db/routines/vn/procedures/buy_afterUpsert.sql @@ -74,6 +74,8 @@ BEGIN WHERE b.id = vSelf; END IF; - + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT vSelf id; + CALL buy_checkItem(); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/buy_chekItem.sql b/db/routines/vn/procedures/buy_chekItem.sql new file mode 100644 index 000000000..0a0f00345 --- /dev/null +++ b/db/routines/vn/procedures/buy_chekItem.sql @@ -0,0 +1,28 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`buy_checkItem`() +BEGIN +/** + * Checks if the item has weightByPiece or size null on any buy. + * + * @param tmp.buysToCheck(id as INT). + */ + DECLARE hasVolumetricAgency INT; + + SELECT a.hasWeightVolumetric INTO hasVolumetricAgency + FROM entry e + JOIN travel t ON t.id = e.travelFk + JOIN agencyMode a ON a.id = t.agencyModeFk + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + JOIN tmp.buysToCheck bt ON bt.id = b.id + WHERE (i.weightByPiece IS NULL OR i.`size` IS NULL) + AND a.hasWeightVolumetric + LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.buysToCheck; + + IF hasVolumetricAgency THEN + CALL util.throw('Some purchase line has an item without size or weight per stem in the volumetric agency.'); + END IF; +END$$ +DELIMITER ; \ No newline at end of file diff --git a/db/routines/vn/procedures/clean.sql b/db/routines/vn/procedures/clean.sql index 1734bea98..0e60fad1d 100644 --- a/db/routines/vn/procedures/clean.sql +++ b/db/routines/vn/procedures/clean.sql @@ -88,6 +88,7 @@ BEGIN FROM vn.expeditionTruck WHERE eta < v3Month; + DELETE FROM XDiario WHERE FECHA < v3Month OR FECHA IS NULL; -- borrar travels sin entradas DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete; CREATE TEMPORARY TABLE tmp.thermographToDelete diff --git a/db/routines/vn/procedures/duaInvoiceInBooking.sql b/db/routines/vn/procedures/duaInvoiceInBooking.sql index 9e794f0ed..77924938b 100644 --- a/db/routines/vn/procedures/duaInvoiceInBooking.sql +++ b/db/routines/vn/procedures/duaInvoiceInBooking.sql @@ -44,7 +44,7 @@ BEGIN IF vCounter > 0 OR vASIEN > 0 THEN - UPDATE vn2008.XDiario x + UPDATE vn.XDiario x JOIN vn.ledgerConfig lc ON lc.lastBookEntry = x.ASIEN SET x.ASIEN = vASIEN; diff --git a/db/routines/vn/procedures/ticket_setState.sql b/db/routines/vn/procedures/ticket_setState.sql index 13a93380d..bde8e0692 100644 --- a/db/routines/vn/procedures/ticket_setState.sql +++ b/db/routines/vn/procedures/ticket_setState.sql @@ -31,8 +31,8 @@ BEGIN CALL util.throw('ASSIGN_ZONE_FIRST'); END IF; - SET vCanChangeState = ( - vStateCode <> 'ON_CHECKING' OR + SET vCanChangeState = (( + vStateCode <> 'ON_CHECKING' AND vStateCode <> 'CHECKED') OR vticketAlertLevel < vPackedAlertLevel )AND NOT ( vTicketStateCode IN ('CHECKED', 'CHECKING') @@ -51,5 +51,6 @@ BEGIN ELSE CALL util.throw('INCORRECT_TICKET_STATE'); END IF; + END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql b/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql new file mode 100644 index 000000000..c586dc57e --- /dev/null +++ b/db/routines/vn/triggers/accountReconciliation_beforeInsert.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`accountReconciliation_beforeInsert` + BEFORE INSERT ON `accountReconciliation` + FOR EACH ROW + + SET NEW.calculatedCode = REPLACE( + REPLACE( + REPLACE( + REPLACE( + CONCAT(NEW.supplierAccountFk,NEW.operationDated,NEW.amount,NEW.concept,NEW.debitCredit) + ,' ','') + ,":",'') + ,'-','') + ,'.','')$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql b/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql new file mode 100644 index 000000000..fd7f4c6e7 --- /dev/null +++ b/db/routines/vn/triggers/awbInvoiceIn_afterDelete.sql @@ -0,0 +1,15 @@ +DELIMITER $$ +CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`awbInvoiceIn_afterDelete` + AFTER DELETE ON `awbInvoiceIn` + FOR EACH ROW +BEGIN + IF (NOT(SELECT COUNT(*) FROM invoiceInTax where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT COUNT(*) FROM invoiceInDueDay where invoiceInFk = OLD.invoiceInFk)) + AND + (NOT(SELECT isBooked FROM invoiceIn WHERE id = OLD.invoiceInFk) ) + THEN + DELETE FROM invoiceIn WHERE id = OLD.invoiceInFk; + END IF; +END$$ +DELIMITER ; diff --git a/db/routines/vn/triggers/buy_beforeUpdate.sql b/db/routines/vn/triggers/buy_beforeUpdate.sql index 4468d3f3a..fc03c456f 100644 --- a/db/routines/vn/triggers/buy_beforeUpdate.sql +++ b/db/routines/vn/triggers/buy_beforeUpdate.sql @@ -41,8 +41,8 @@ trig:BEGIN FROM genericAllocation ga JOIN entry e ON e.id = NEW.entryFk JOIN travel tr on tr.id = e.travelFk - WHERE ga.itemFk = vGenericFk - AND tr.landed BETWEEN ga.startDated AND ga.endDated; + WHERE ga.itemFk = vGenericFk + AND tr.landed BETWEEN ga.startDated AND ga.endDated; IF vGenericInDate THEN SET NEW.itemOriginalFk = NEW.itemFk; SET NEW.itemFk = vGenericFk; @@ -64,5 +64,12 @@ trig:BEGIN IF NEW.quantity < 0 THEN SET NEW.isIgnored = TRUE; END IF; + + IF NOT (NEW.itemFk <=> OLD.itemFk) OR + NOT (OLD.entryFk <=> NEW.entryFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT NEW.id; + CALL buy_checkItem(); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/entry_afterUpdate.sql b/db/routines/vn/triggers/entry_afterUpdate.sql index 6d1ad0720..60adc0003 100644 --- a/db/routines/vn/triggers/entry_afterUpdate.sql +++ b/db/routines/vn/triggers/entry_afterUpdate.sql @@ -13,5 +13,15 @@ BEGIN CALL travel_requestRecalc(OLD.travelFk); CALL travel_requestRecalc(NEW.travelFk); END IF; + + + IF NOT (NEW.travelFk <=> OLD.travelFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM buy b + WHERE b.entryFk = NEW.id; + + CALL buy_checkItem(); + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/travel_afterUpdate.sql b/db/routines/vn/triggers/travel_afterUpdate.sql index 8c639cca7..b4e40ae41 100644 --- a/db/routines/vn/triggers/travel_afterUpdate.sql +++ b/db/routines/vn/triggers/travel_afterUpdate.sql @@ -10,5 +10,18 @@ BEGIN SET commission = entry_getCommission(travelFk, currencyFk,supplierFk) WHERE travelFk = NEW.id; END IF; + + IF NOT (NEW.agencyModeFk <=> OLD.agencyModeFk) THEN + IF (SELECT hasWeightVolumetric FROM agencyMode WHERE id = NEW.agencyModeFk) THEN + CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck + SELECT b.id + FROM entry e + JOIN buy b ON b.entryFk = e.id + JOIN item i ON i.id = b.itemFk + WHERE e.travelFk = NEW.id; + + CALL buy_checkItem(); + END IF; + END IF; END$$ DELIMITER ; diff --git a/db/routines/vn/triggers/travel_beforeUpdate.sql b/db/routines/vn/triggers/travel_beforeUpdate.sql index 440b21c04..2079cd21e 100644 --- a/db/routines/vn/triggers/travel_beforeUpdate.sql +++ b/db/routines/vn/triggers/travel_beforeUpdate.sql @@ -4,15 +4,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate` FOR EACH ROW BEGIN SET NEW.editorFk = account.myUser_getId(); -/* - IF ((NOT NEW.shipped <=> OLD.shipped ) - OR (NOT NEW.landed <=> OLD.landed ) - OR (NOT NEW.warehouseInFk <=> OLD.warehouseInFk ) - OR (NOT NEW.warehouseOutFk <=> OLD.warehouseOutFk )) - AND (OLD.totalEntries AND OLD.landed < CURDATE()) THEN - CALL util.throw("Cannot past travels with entries"); - END IF; -*/ + IF NOT (NEW.landed <=> OLD.landed) OR NOT (NEW.shipped <=> OLD.shipped) THEN CALL travel_checkDates(NEW.shipped, NEW.landed); diff --git a/db/routines/vn/views/bankPolicy.sql b/db/routines/vn/views/bankPolicy.sql deleted file mode 100644 index e329d2b2c..000000000 --- a/db/routines/vn/views/bankPolicy.sql +++ /dev/null @@ -1,24 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn`.`bankPolicy` -AS SELECT `bp`.`poliza_id` AS `id`, - `bp`.`referencia` AS `ref`, - `bp`.`importe` AS `amount`, - `bp`.`com_dispuesto` AS `balanceInterestDrawn`, - `bp`.`com_no_dispuesto` AS `commissionAvailableBalances`, - `bp`.`com_anual` AS `openingCommission`, - `bp`.`apertura` AS `started`, - `bp`.`cierre` AS `ended`, - `bp`.`Id_Banco` AS `bankFk`, - `bp`.`empresa_id` AS `companyFk`, - `bp`.`supplierFk` AS `supplierFk`, - `bp`.`description` AS `description`, - `bp`.`hasGuarantee` AS `hasGuarantee`, - `bp`.`dmsFk` AS `dmsFk`, - `bp`.`notaryFk` AS `notaryFk`, - `bp`.`currencyFk` AS `currencyFk`, - `bp`.`amortizationTypeFk` AS `amortizationTypeFk`, - `bp`.`periodicityTypeFk` AS `periodicityTypeFk`, - `bp`.`insuranceExpired` AS `insuranceExpired` -FROM `vn2008`.`Bancos_poliza` `bp` -ORDER BY `bp`.`poliza_id` DESC diff --git a/db/routines/vn/views/itemShelvingAvailable.sql b/db/routines/vn/views/itemShelvingAvailable.sql index 868d6a963..e9599a1db 100644 --- a/db/routines/vn/views/itemShelvingAvailable.sql +++ b/db/routines/vn/views/itemShelvingAvailable.sql @@ -38,7 +38,7 @@ FROM ( ) JOIN `vn`.`agencyMode` `am` ON(`am`.`id` = `t`.`agencyModeFk`) ) - JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`) + JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticket` = `t`.`id`) ) JOIN `vn`.`state` `st` ON(`st`.`id` = `tst`.`state`) ) diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql index cf1f24539..2ee65b7c2 100644 --- a/db/routines/vn/views/ticketStateToday.sql +++ b/db/routines/vn/views/ticketStateToday.sql @@ -1,16 +1,15 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `vn`.`ticketStateToday` -AS SELECT `ts`.`ticketFk` AS `ticket`, +AS SELECT + `ts`.`ticketFk` AS `ticketFk`, `ts`.`state` AS `state`, `ts`.`productionOrder` AS `productionOrder`, `ts`.`alertLevel` AS `alertLevel`, - `ts`.`userFk` AS `worker`, + `ts`.`userFk` AS `userFk`, `ts`.`code` AS `code`, `ts`.`updated` AS `updated`, `ts`.`isPicked` AS `isPicked` -FROM ( - `vn`.`ticketState` `ts` - JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`) - ) -WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()) +FROM `ticketState` `ts` + JOIN `ticket` `t` ON `t`.`id` = `ts`.`ticketFk` +WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()); diff --git a/db/routines/vn/views/zoneEstimatedDelivery.sql b/db/routines/vn/views/zoneEstimatedDelivery.sql index e52d5487e..621d1a8f0 100644 --- a/db/routines/vn/views/zoneEstimatedDelivery.sql +++ b/db/routines/vn/views/zoneEstimatedDelivery.sql @@ -9,7 +9,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` lhp.m3, dl.minSpeed FROM ticket t - JOIN ticketStateToday tst ON tst.ticket = t.id + JOIN ticketStateToday tst ON tst.ticketFk = t.id JOIN state s ON s.id = tst.state JOIN saleVolume sv ON sv.ticketFk = t.id LEFT JOIN lastHourProduction lhp ON lhp.warehouseFk = t.warehouseFk diff --git a/db/routines/vn2008/procedures/XDiario_Quadrator.sql b/db/routines/vn2008/procedures/XDiario_Quadrator.sql index c95a3a892..93ddc231d 100644 --- a/db/routines/vn2008/procedures/XDiario_Quadrator.sql +++ b/db/routines/vn2008/procedures/XDiario_Quadrator.sql @@ -7,19 +7,19 @@ BEGIN group_concat(CONCAT(' Asiento: ', ASIEN, '- importe:', quadre) SEPARATOR ' \r\n ') FROM ( SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) quadre - FROM XDiario + FROM vn.XDiario WHERE enlazado = FALSE GROUP BY ASIEN HAVING ABS(SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0))) > 0.01 ) t HAVING count(*) > 0; - UPDATE XDiario XD + UPDATE vn.XDiario XD INNER JOIN( - SELECT XD.id, SUBCTA, Quadre FROM XDiario XD + SELECT XD.id, SUBCTA, Quadre FROM vn.XDiario XD INNER JOIN ( SELECT ASIEN, SUM(IFNULL(ROUND(Eurodebe,2),0))- SUM(IFNULL(ROUND(EUROHABER,2),0)) as Quadre - FROM XDiario + FROM vn.XDiario WHERE enlazado = FALSE GROUP BY ASIEN HAVING Quadre != 0 diff --git a/db/routines/vn2008/procedures/clean.sql b/db/routines/vn2008/procedures/clean.sql index f63edc80a..bd8a324c6 100644 --- a/db/routines/vn2008/procedures/clean.sql +++ b/db/routines/vn2008/procedures/clean.sql @@ -23,7 +23,6 @@ proc: BEGIN DELETE FROM cdr WHERE calldate < vDate18; DELETE FROM Monitoring WHERE ODBC_TIME < vDate; DELETE FROM Conteo WHERE Fecha < vDate; - DELETE FROM XDiario WHERE FECHA < vDate3 OR FECHA IS NULL; DELETE FROM mail WHERE DATE_ODBC < vDate; DELETE FROM expeditions_deleted WHERE odbc_date < vDate26; DELETE FROM Movimientos_mark WHERE odbc_date < vDate; diff --git a/db/routines/vn2008/procedures/cobro.sql b/db/routines/vn2008/procedures/cobro.sql index fb6010f38..26d906813 100644 --- a/db/routines/vn2008/procedures/cobro.sql +++ b/db/routines/vn2008/procedures/cobro.sql @@ -25,7 +25,7 @@ BEGIN FROM Clientes WHERE Id_Cliente = idCLI; CALL vn.ledger_next(max_asien); - INSERT INTO XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) + INSERT INTO vn.XDiario (ASIEN,FECHA,SUBCTA,CONTRA,CONCEPTO,EURODEBE,EUROHABER,empresa_id) SELECT max_asien,datFEC,SUBCTA,CONTRA,strCONCEPTO,EURODEBE,EUROHABER,idEMP FROM(SELECT cuenta_banco SUBCTA, cuenta_cliente CONTRA, 0 EURODEBE, dblIMPORTE EUROHABER UNION ALL diff --git a/db/routines/vn2008/procedures/confection_control_source.sql b/db/routines/vn2008/procedures/confection_control_source.sql index f439e80f7..77b4df5f3 100644 --- a/db/routines/vn2008/procedures/confection_control_source.sql +++ b/db/routines/vn2008/procedures/confection_control_source.sql @@ -31,7 +31,7 @@ BEGIN stock.available FROM vn2008.Tickets t JOIN vn2008.Agencias a ON a.Id_Agencia = t.Id_Agencia - JOIN vn2008.warehouse wh ON wh.id = t.warehouse_id + JOIN vn.warehouse wh ON wh.id = t.warehouse_id JOIN vn2008.Movimientos m ON m.Id_Ticket = t.Id_Ticket JOIN vn2008.Articles i ON i.Id_Article = m.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = i.tipo_id @@ -88,8 +88,8 @@ BEGIN FROM vn2008.Compres c JOIN vn2008.Entradas e ON e.Id_Entrada = c.Id_Entrada JOIN vn2008.travel tr ON tr.id = e.travel_id - JOIN vn2008.warehouse whi ON whi.id = tr.warehouse_id - JOIN vn2008.warehouse who ON who.id = tr.warehouse_id_out + JOIN vn.warehouse whi ON whi.id = tr.warehouse_id + JOIN vn.warehouse who ON who.id = tr.warehouse_id_out JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article JOIN vn2008.Tipos tp ON tp.tipo_id = a.tipo_id JOIN vn.confectionType ct ON ct.id = tp.confeccion diff --git a/db/routines/vn2008/triggers/Conteo_afterInsert.sql b/db/routines/vn2008/triggers/Conteo_afterInsert.sql deleted file mode 100644 index 90f2a5edd..000000000 --- a/db/routines/vn2008/triggers/Conteo_afterInsert.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`Conteo_afterInsert` - AFTER INSERT ON `Conteo` - FOR EACH ROW -BEGIN - DECLARE intTravel INTEGER; - SELECT t.id INTO intTravel FROM Compres c JOIN Entradas e ON e.Id_Entrada = c.Id_Entrada - JOIN travel t ON t.id = e.travel_id - WHERE landing = util.VN_CURDATE() AND c.Id_Article = NEW.Id_Article AND warehouse_id = NEW.warehouse_id AND received <> TRUE LIMIT 1; - IF (intTravel) then - UPDATE travel SET received = TRUE WHERE id = intTravel; - END IF; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/triggers/account_conciliacion_beforeInsert.sql b/db/routines/vn2008/triggers/account_conciliacion_beforeInsert.sql deleted file mode 100644 index fb6283e1a..000000000 --- a/db/routines/vn2008/triggers/account_conciliacion_beforeInsert.sql +++ /dev/null @@ -1,14 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`account_conciliacion_beforeInsert` - BEFORE INSERT ON `account_conciliacion` - FOR EACH ROW -set new.id_calculated = replace( - replace( - replace( - replace( - concat(new.Id_Proveedores_account,new.Fechaoperacion,new.importe,new.Concepto,new.DebeHaber) - ,' ','') - ,":",'') - ,'-','') - ,'.','')$$ -DELIMITER ; diff --git a/db/routines/vn2008/triggers/agency_hour_afterUpdate.sql b/db/routines/vn2008/triggers/agency_hour_afterUpdate.sql deleted file mode 100644 index 81996137b..000000000 --- a/db/routines/vn2008/triggers/agency_hour_afterUpdate.sql +++ /dev/null @@ -1,18 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`agency_hour_afterUpdate` - AFTER UPDATE ON `agency_hour` - FOR EACH ROW -BEGIN -DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - END IF; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/triggers/agency_hour_beforeInsert.sql b/db/routines/vn2008/triggers/agency_hour_beforeInsert.sql deleted file mode 100644 index a6007934e..000000000 --- a/db/routines/vn2008/triggers/agency_hour_beforeInsert.sql +++ /dev/null @@ -1,21 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`agency_hour_beforeInsert` - BEFORE INSERT ON `agency_hour` - FOR EACH ROW -BEGIN - DECLARE vAlreadyExists BOOLEAN DEFAULT FALSE; - IF NEW.week_day IS NULL AND NEW.province_id IS NULL AND NEW.subtract_day = 0 AND NEW.max_hour = 0 THEN - CALL util.throw ('FILL_MORE_FIELDS'); - END IF; - - SELECT COUNT(*) INTO vAlreadyExists - FROM vn2008.agency_hour - WHERE NEW.week_day <=> week_day AND NEW.province_id <=> province_id - AND NEW.warehouse_id <=> warehouse_id AND NEW.max_hour <=> max_hour - AND NEW.agency_id <=> agency_id; - - IF vAlreadyExists > 1 THEN - CALL util.throw('ALREADY_EXISTS'); - END IF; -END$$ -DELIMITER ; diff --git a/db/routines/vn2008/triggers/awb_recibida_afterDelete.sql b/db/routines/vn2008/triggers/awb_recibida_afterDelete.sql deleted file mode 100644 index 6a3380b8f..000000000 --- a/db/routines/vn2008/triggers/awb_recibida_afterDelete.sql +++ /dev/null @@ -1,13 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn2008`.`awb_recibida_afterDelete` - AFTER DELETE ON `awb_recibida` - FOR EACH ROW -IF (SELECT COUNT(*) FROM recibida_iva where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT COUNT(*) FROM recibida_vencimiento where recibida_id = OLD.recibida_id) = 0 - AND - (SELECT contabilizada FROM recibida WHERE id = OLD.recibida_id) = 0 -THEN - DELETE FROM recibida WHERE id = OLD.recibida_id; -END IF$$ -DELIMITER ; diff --git a/db/routines/vn2008/views/Bancos_poliza.sql b/db/routines/vn2008/views/Bancos_poliza.sql new file mode 100644 index 000000000..4cd443545 --- /dev/null +++ b/db/routines/vn2008/views/Bancos_poliza.sql @@ -0,0 +1,24 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Bancos_poliza` +AS SELECT `bp`.`id` AS `poliza_id`, + `bp`.`ref` AS `referencia`, + `bp`.`amount` AS `importe`, + `bp`.`committedFee` AS `com_dispuesto`, + `bp`.`nonCommittedFee` AS `com_no_dispuesto`, + `bp`.`annualFee` AS `com_anual`, + `bp`.`started` AS `apertura`, + `bp`.`ended` AS `cierre`, + `bp`.`accountingFk` AS `Id_Banco`, + `bp`.`companyFk` AS `empresa_id`, + `bp`.`supplierFk` AS `supplierFk`, + `bp`.`description` AS `description`, + `bp`.`hasGuarantee` AS `hasGuarantee`, + `bp`.`dmsFk` AS `dmsFk`, + `bp`.`notaryFk` AS `notaryFk`, + `bp`.`currencyFk` AS `currencyFk`, + `bp`.`amortizationTypeFk` AS `amortizationTypeFk`, + `bp`.`periodicityTypeFk` AS `periodicityTypeFk`, + `bp`.`insuranceExpired` AS `insuranceExpired` +FROM `vn`.`bankPolicy` `bp` +ORDER BY `bp`.`id` DESC diff --git a/db/routines/vn2008/views/Entradas_orden.sql b/db/routines/vn2008/views/Entradas_orden.sql new file mode 100644 index 000000000..66f46a929 --- /dev/null +++ b/db/routines/vn2008/views/Entradas_orden.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Entradas_orden` +AS SELECT `eo`.`entryFk` AS `Id_Entrada`, + `eo`.`order` AS `orden` +FROM `vn`.`entryOrder` `eo` diff --git a/db/routines/vn2008/views/Equipos.sql b/db/routines/vn2008/views/Equipos.sql deleted file mode 100644 index fd1210237..000000000 --- a/db/routines/vn2008/views/Equipos.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Equipos` -AS SELECT `h`.`code` AS `alias`, - `h`.`description` AS `descripcion`, - `h`.`workerFk` AS `trabajador_id`, - `h`.`windowsSerial` AS `windowsSerial` -FROM `vn`.`host` `h` diff --git a/db/routines/vn2008/views/Prioridades.sql b/db/routines/vn2008/views/Prioridades.sql deleted file mode 100644 index 7e89a538f..000000000 --- a/db/routines/vn2008/views/Prioridades.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Prioridades` -AS SELECT `qp`.`id` AS `Id_Prioridad`, - `qp`.`priority` AS `Prioridad` -FROM `vn`.`queuePriority` `qp` diff --git a/db/routines/vn2008/views/Proveedores_gestdoc.sql b/db/routines/vn2008/views/Proveedores_gestdoc.sql new file mode 100644 index 000000000..c25623b8b --- /dev/null +++ b/db/routines/vn2008/views/Proveedores_gestdoc.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Proveedores_gestdoc` +AS SELECT `sd`.`supplierFk` AS `Id_Proveedor`, + `sd`.`dmsFk` AS `gestdoc_id` +FROM `vn`.`supplierDms` `sd` diff --git a/db/routines/vn2008/views/Remesas.sql b/db/routines/vn2008/views/Remesas.sql new file mode 100644 index 000000000..9e8c18ada --- /dev/null +++ b/db/routines/vn2008/views/Remesas.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Remesas` +AS SELECT `r`.`id` AS `Id_Remesa`, + `r`.`dated` AS `Fecha Remesa`, + `r`.`accountingFk` AS `Banco`, + `r`.`companyFk` AS `empresa_id` +FROM `vn`.`remittance` `r` diff --git a/db/routines/vn2008/views/Saldos_Prevision.sql b/db/routines/vn2008/views/Saldos_Prevision.sql new file mode 100644 index 000000000..f4749d30f --- /dev/null +++ b/db/routines/vn2008/views/Saldos_Prevision.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Saldos_Prevision` +AS SELECT `fb`.`id` AS `Saldos_Prevision_id`, + `fb`.`description` AS `Descripcion`, + `fb`.`amount` AS `Importe`, + `fb`.`dated` AS `Fecha`, + `fb`.`accountingFk` AS `Id_Banco`, + `fb`.`companyFk` AS `empresa_id` +FROM `vn`.`forecastedBalance` `fb` \ No newline at end of file diff --git a/db/routines/vn2008/views/Split.sql b/db/routines/vn2008/views/Split.sql new file mode 100644 index 000000000..eec90a5f8 --- /dev/null +++ b/db/routines/vn2008/views/Split.sql @@ -0,0 +1,9 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Splits` +AS SELECT `s`.`id` AS `Id_Split`, + `s`.`ticketFk` AS `Id_Ticket`, + `s`.`entryFk` AS `Id_Entrada`, + `s`.`dated` AS `Fecha`, + `s`.`note` AS `Notas` +FROM `vn`.`split` `s` \ No newline at end of file diff --git a/db/routines/vn2008/views/Split_lines.sql b/db/routines/vn2008/views/Split_lines.sql new file mode 100644 index 000000000..0b7897be7 --- /dev/null +++ b/db/routines/vn2008/views/Split_lines.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Split_lines` +AS SELECT `sl`.`id` AS `Id_Split_lines`, + `sl`.`splitFk` AS `Id_Split`, + `sl`.`itemFk` AS `Id_Article`, + `sl`.`buyFk` AS `Id_Compra` +FROM `vn`.`splitLine` `sl` \ No newline at end of file diff --git a/db/routines/vn2008/views/Vehiculos.sql b/db/routines/vn2008/views/Vehiculos.sql deleted file mode 100644 index 477ff657c..000000000 --- a/db/routines/vn2008/views/Vehiculos.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`Vehiculos` -AS SELECT `v`.`id` AS `Id_Vehiculo`, - `v`.`numberPlate` AS `Matricula`, - `v`.`tradeMark` AS `Marca`, - `v`.`model` AS `Modelo`, - `v`.`companyFk` AS `empresa_id`, - `v`.`warehouseFk` AS `warehouseFk`, - `v`.`description` AS `description`, - `v`.`m3` AS `m3`, - `v`.`isActive` AS `active`, - `v`.`deliveryPointFk` AS `deliveryPointFk` -FROM `vn`.`vehicle` `v` diff --git a/db/routines/vn2008/views/Vehiculos_consumo.sql b/db/routines/vn2008/views/Vehiculos_consumo.sql new file mode 100644 index 000000000..422a77499 --- /dev/null +++ b/db/routines/vn2008/views/Vehiculos_consumo.sql @@ -0,0 +1,20 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Vehiculos_consumo` +AS SELECT `vc`.`id` AS `Vehiculos_consumo_id`, + `vc`.`vehicleFk` AS `Id_Vehiculo`, + `vc`.`dated` AS `fecha`, + `vc`.`km` AS `km`, + `vc`.`liters` AS `litros`, + `vc`.`price` AS `precio`, + `vc`.`adblue` AS `adblue`, + `vc`.`tolls` AS `peajes`, + `vc`.`discount` AS `descuento`, + `vc`.`silla` AS `silla`, + `vc`.`created` AS `odbc_date`, + `vc`.`others` AS `otros`, + `vc`.`fuelTypeFk` AS `fuelTypeFk`, + `vc`.`supplierFk` AS `proveedoresFk`, + `vc`.`liters100km` AS `liters100km`, + `vc`.`gasoline` AS `gasoline` +FROM `vn`.`vehicleConsumption` `vc` \ No newline at end of file diff --git a/db/routines/vn2008/views/XDiario.sql b/db/routines/vn2008/views/XDiario.sql deleted file mode 100644 index 0a9672d2e..000000000 --- a/db/routines/vn2008/views/XDiario.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`XDiario` -AS SELECT `d`.`id` AS `id`, - `d`.`ASIEN` AS `ASIEN`, - `d`.`FECHA` AS `FECHA`, - `d`.`SUBCTA` AS `SUBCTA`, - `d`.`CONTRA` AS `CONTRA`, - `d`.`CONCEPTO` AS `CONCEPTO`, - `d`.`EURODEBE` AS `EURODEBE`, - `d`.`EUROHABER` AS `EUROHABER`, - `d`.`BASEEURO` AS `BASEEURO`, - `d`.`SERIE` AS `SERIE`, - `d`.`FACTURA` AS `FACTURA`, - `d`.`IVA` AS `IVA`, - `d`.`RECEQUIV` AS `RECEQUIV`, - `d`.`CLAVE` AS `CLAVE`, - `d`.`CAMBIO` AS `CAMBIO`, - `d`.`DEBEME` AS `DEBEME`, - `d`.`HABERME` AS `HABERME`, - `d`.`AUXILIAR` AS `AUXILIAR`, - `d`.`MONEDAUSO` AS `MONEDAUSO`, - `d`.`TIPOOPE` AS `TIPOOPE`, - `d`.`NFACTICK` AS `NFACTICK`, - `d`.`TERIDNIF` AS `TERIDNIF`, - `d`.`TERNIF` AS `TERNIF`, - `d`.`TERNOM` AS `TERNOM`, - `d`.`OPBIENES` AS `OPBIENES`, - `d`.`L340` AS `L340`, - `d`.`enlazado` AS `enlazado`, - `d`.`FECHA_EX` AS `FECHA_EX`, - `d`.`LRECT349` AS `LRECT349`, - `d`.`empresa_id` AS `empresa_id`, - `d`.`LDIFADUAN` AS `LDIFADUAN`, - `d`.`METAL` AS `METAL`, - `d`.`METALIMP` AS `METALIMP`, - `d`.`CLIENTE` AS `CLIENTE`, - `d`.`METALEJE` AS `METALEJE`, - `d`.`FECHA_OP` AS `FECHA_OP`, - `d`.`FACTURAEX` AS `FACTURAEX`, - `d`.`TIPOCLAVE` AS `TIPOCLAVE`, - `d`.`TIPOEXENCI` AS `TIPOEXENCI`, - `d`.`TIPONOSUJE` AS `TIPONOSUJE`, - `d`.`TIPOFACT` AS `TIPOFACT`, - `d`.`TIPORECTIF` AS `TIPORECTIF`, - `d`.`SERIE_RT` AS `SERIE_RT`, - `d`.`FACTU_RT` AS `FACTU_RT`, - `d`.`BASEIMP_RT` AS `BASEIMP_RT`, - `d`.`BASEIMP_RF` AS `BASEIMP_RF`, - `d`.`RECTIFICA` AS `RECTIFICA`, - `d`.`FECHA_RT` AS `FECHA_RT`, - `d`.`created` AS `created`, - `d`.`updated` AS `updated`, - `d`.`FECREGCON` AS `FECREGCON`, - `d`.`enlazadoSage` AS `enlazadoSage` -FROM `vn`.`XDiario` `d` diff --git a/db/routines/vn2008/views/account_conciliacion.sql b/db/routines/vn2008/views/account_conciliacion.sql new file mode 100644 index 000000000..66db78eee --- /dev/null +++ b/db/routines/vn2008/views/account_conciliacion.sql @@ -0,0 +1,13 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_conciliacion` +AS SELECT `ar`.`id` AS `idaccount_conciliacion`, + `ar`.`supplierAccountFk` AS `Id_Proveedores_account`, + `ar`.`operationDated` AS `Fechaoperacion`, + `ar`.`valueDated` AS `FechaValor`, + `ar`.`amount` AS `importe`, + `ar`.`concept` AS `Concepto`, + `ar`.`debitCredit` AS `DebeHaber`, + `ar`.`calculatedCode` AS `id_calculated`, + `ar`.`created` AS `odbc_date` +FROM `vn`.`accountReconciliation` `ar` diff --git a/db/routines/vn2008/views/account_detail.sql b/db/routines/vn2008/views/account_detail.sql new file mode 100644 index 000000000..74d35ae41 --- /dev/null +++ b/db/routines/vn2008/views/account_detail.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_detail` +AS SELECT `ac`.`id` AS `account_detail_id`, + `ac`.`value` AS `value`, + `ac`.`accountDetailTypeFk` AS `account_detail_type_id`, + `ac`.`supplierAccountFk` AS `Id_Proveedores_account` +FROM `vn`.`accountDetail` `ac` diff --git a/db/routines/vn2008/views/account_detail_type.sql b/db/routines/vn2008/views/account_detail_type.sql new file mode 100644 index 000000000..6def86a9a --- /dev/null +++ b/db/routines/vn2008/views/account_detail_type.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_detail_type` +AS SELECT `adt`.`id` AS `account_detail_type_id`, + `adt`.`description` AS `description` +FROM `vn`.`accountDetailType` `adt` diff --git a/db/routines/vn2008/views/airline.sql b/db/routines/vn2008/views/airline.sql new file mode 100644 index 000000000..786206b1c --- /dev/null +++ b/db/routines/vn2008/views/airline.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`airline` +AS SELECT `a`.`id` AS `airline_id`, + `a`.`name` AS `name` +FROM `vn`.`airline` `a` diff --git a/db/routines/vn2008/views/airport.sql b/db/routines/vn2008/views/airport.sql new file mode 100644 index 000000000..0e8ab39d2 --- /dev/null +++ b/db/routines/vn2008/views/airport.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`airport` +AS SELECT `a`.`id` AS `airport_id`, + `a`.`name` AS `name` +FROM `vn`.`airport` `a` diff --git a/db/routines/vn2008/views/albaran.sql b/db/routines/vn2008/views/albaran.sql new file mode 100644 index 000000000..51a7c77e9 --- /dev/null +++ b/db/routines/vn2008/views/albaran.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran` +AS SELECT `dn`.`id` AS `albaran_id`, + `dn`.`ref` AS `ref`, + `dn`.`note` AS `note`, + `dn`.`shipped` AS `fecha`, + `dn`.`landed` AS `fecha_entrega`, + `dn`.`amount` AS `valor`, + `dn`.`supplierFk` AS `Id_Proveedor`, + `dn`.`companyFk` AS `empresa_id`, + `dn`.`warehouseFk` AS `warehouse_id`, + `dn`.`stateFk` AS `albaran_state_id`, + `dn`.`workerFk` AS `Id_Trabajador`, + `dn`.`supervisorFk` AS `Id_Responsable`, + `dn`.`departmentFk` AS `department_id`, + `dn`.`invoiceInFk` AS `recibida_id`, + `dn`.`farmingFk` AS `farmingFk` +FROM `vn`.`deliveryNote` `dn` diff --git a/db/routines/vn2008/views/albaran_gestdoc.sql b/db/routines/vn2008/views/albaran_gestdoc.sql new file mode 100644 index 000000000..ffde86937 --- /dev/null +++ b/db/routines/vn2008/views/albaran_gestdoc.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran_gestdoc` +AS SELECT `dnd`.`dmsFk` AS `gestdoc_id`, + `dnd`.`deliveryNoteFk` AS `albaran_id` +FROM `vn`.`deliveryNoteDms` `dnd` diff --git a/db/routines/vn2008/views/albaran_state.sql b/db/routines/vn2008/views/albaran_state.sql new file mode 100644 index 000000000..a15938f45 --- /dev/null +++ b/db/routines/vn2008/views/albaran_state.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran_state` +AS SELECT `dn`.`id` AS `albaran_state_id`, + `dn`.`state` AS `state` +FROM `vn`.`deliveryNoteState` `dn` diff --git a/db/routines/vn2008/views/awb_component.sql b/db/routines/vn2008/views/awb_component.sql new file mode 100644 index 000000000..8053c4a59 --- /dev/null +++ b/db/routines/vn2008/views/awb_component.sql @@ -0,0 +1,14 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component` +AS SELECT `ac`.`id` AS `id`, + `ac`.`awbFk` AS `awb_id`, + `ac`.`supplierFk` AS `Id_Proveedor`, + `ac`.`typeFk` AS `awb_component_type_id`, + `ac`.`awbRoleFk` AS `awb_role_id`, + `ac`.`awbUnitFk` AS `awb_unit_id`, + `ac`.`value` AS `value`, + `ac`.`currencyFk` AS `Id_Moneda`, + `ac`.`invoiceInFk` AS `recibida_id` +FROM + `vn`.`awbComponent` `ac`; \ No newline at end of file diff --git a/db/routines/vn2008/views/awb_component_template.sql b/db/routines/vn2008/views/awb_component_template.sql new file mode 100644 index 000000000..bc8fd1cd8 --- /dev/null +++ b/db/routines/vn2008/views/awb_component_template.sql @@ -0,0 +1,19 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component_template` +AS SELECT`act`.`id` AS `awb_component_template_id`, + `act`.`freightFk` AS `carguera_id`, + `act`.`airportIn` AS `airport_in`, + `act`.`airportOut` AS `airport_out`, + `act`.`airlineFk` AS `airline_id`, + `act`.`typeFk` AS `awb_component_type_id`, + `act`.`dated` AS `Fecha`, + `act`.`awbRoleFk` AS `awb_role_id`, + `act`.`awbUnit` AS `awb_unit_id`, + `act`.`value` AS `value`, + `act`.`maxValue` AS `max_value`, + `act`.`minValue` AS `min_value`, + `act`.`currencyFk` AS `Id_Moneda`, + `act`.`days` AS `days` +FROM + `vn`.`awbComponentTemplate` `act`; diff --git a/db/routines/vn2008/views/awb_component_type.sql b/db/routines/vn2008/views/awb_component_type.sql new file mode 100644 index 000000000..45921e11c --- /dev/null +++ b/db/routines/vn2008/views/awb_component_type.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component_type` +AS SELECT `act`.`id` AS `awb_component_type_id`, + `act`.`description` AS `description`, + `act`.`hasStems` AS `hasStems` +FROM `vn`.`awbComponentType` `act` diff --git a/db/routines/vn2008/views/awb_gestdoc.sql b/db/routines/vn2008/views/awb_gestdoc.sql new file mode 100644 index 000000000..6b5c58d56 --- /dev/null +++ b/db/routines/vn2008/views/awb_gestdoc.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_gestdoc` +AS SELECT `ad`.`id` AS `awb_gestdoc_id`, + `ad`.`awbFk` AS `awb_id`, + `ad`.`dmsFk` AS `gestdoc_id` +FROM `vn`.`awbDms` `ad` diff --git a/db/routines/vn2008/views/awb_recibida.sql b/db/routines/vn2008/views/awb_recibida.sql new file mode 100644 index 000000000..c7586214d --- /dev/null +++ b/db/routines/vn2008/views/awb_recibida.sql @@ -0,0 +1,7 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_recibida` +AS SELECT `aii`.`awbFk` AS `awb_id`, + `aii`.`invoiceInFk` AS `recibida_id`, + `aii`.`sad` AS `dua` +FROM `vn`.`awbInvoiceIn` `aii`; diff --git a/db/routines/vn2008/views/awb_role.sql b/db/routines/vn2008/views/awb_role.sql new file mode 100644 index 000000000..5ef004244 --- /dev/null +++ b/db/routines/vn2008/views/awb_role.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_role` +AS SELECT `ar`.`id` AS `awb_role_id`, + `ar`.`name` AS `name` +FROM `vn`.`awbRole` `ar` diff --git a/db/routines/vn2008/views/awb_unit.sql b/db/routines/vn2008/views/awb_unit.sql new file mode 100644 index 000000000..7d1193105 --- /dev/null +++ b/db/routines/vn2008/views/awb_unit.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_unit` +AS SELECT `au`.`id` AS `awb_unit_id`, + `au`.`operation` AS `operation` +FROM `vn`.`awbUnit` `au` diff --git a/db/routines/vn2008/views/balance_nest_tree.sql b/db/routines/vn2008/views/balance_nest_tree.sql new file mode 100644 index 000000000..66d048d7f --- /dev/null +++ b/db/routines/vn2008/views/balance_nest_tree.sql @@ -0,0 +1,10 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`balance_nest_tree` +AS SELECT `bnt`.`lft` AS `lft`, + `bnt`.`rgt` AS `rgt`, + `bnt`.`name` AS `name`, + `bnt`.`id` AS `id`, + `bnt`.`expenseFk` AS `Id_Gasto`, + `bnt`.`isSelected` AS `isSelected` +FROM `vn`.`balanceNestTree` `bnt` diff --git a/db/routines/vn2008/views/buy_edi_k012.sql b/db/routines/vn2008/views/buy_edi_k012.sql new file mode 100644 index 000000000..8ef89e5c9 --- /dev/null +++ b/db/routines/vn2008/views/buy_edi_k012.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k012` +AS SELECT `eek`.`id` AS `buy_edi_k012_id`, + `eek`.`description` AS `description` +FROM `edi`.`ektK1` `eek` diff --git a/db/routines/vn2008/views/buy_edi_k03.sql b/db/routines/vn2008/views/buy_edi_k03.sql new file mode 100644 index 000000000..04ca10ef5 --- /dev/null +++ b/db/routines/vn2008/views/buy_edi_k03.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k03` +AS SELECT `eek`.`id` AS `buy_edi_k03_id`, + `eek`.`description` AS `description` +FROM `edi`.`ektK3` `eek` diff --git a/db/routines/vn2008/views/buy_edi_k04.sql b/db/routines/vn2008/views/buy_edi_k04.sql new file mode 100644 index 000000000..3c32e3b88 --- /dev/null +++ b/db/routines/vn2008/views/buy_edi_k04.sql @@ -0,0 +1,6 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k04` +AS SELECT `eek`.`id` AS `buy_edi_k04_id`, + `eek`.`description` AS `description` +FROM `edi`.`ektK4` `eek` diff --git a/db/routines/vn2008/views/definitivo.sql b/db/routines/vn2008/views/definitivo.sql new file mode 100644 index 000000000..1bc554161 --- /dev/null +++ b/db/routines/vn2008/views/definitivo.sql @@ -0,0 +1,9 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`definitivo` +AS SELECT `d`.`id` AS `definitivo_id`, + `d`.`companyFk` AS `empresa_id`, + `d`.`started` AS `desde`, + `d`.`ended` AS `hasta`, + `d`.`created` AS `fecha` +FROM `vn`.`dmsStorageBox` `d` diff --git a/db/routines/vn2008/views/deliveryPoint.sql b/db/routines/vn2008/views/deliveryPoint.sql deleted file mode 100644 index 7763bc9fa..000000000 --- a/db/routines/vn2008/views/deliveryPoint.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`deliveryPoint` -AS SELECT `dp`.`id` AS `id`, - `dp`.`name` AS `name`, - `dp`.`ubication` AS `ubication` -FROM `vn`.`deliveryPoint` `dp` diff --git a/db/routines/vn2008/views/device_user.sql b/db/routines/vn2008/views/device_user.sql deleted file mode 100644 index 52a2faafa..000000000 --- a/db/routines/vn2008/views/device_user.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`device_user` -AS SELECT `dpu`.`deviceProductionFk` AS `device_id`, - `dpu`.`userFk` AS `user_id` -FROM `vn`.`deviceProductionUser` `dpu` diff --git a/db/routines/vn2008/views/edi_feature.sql b/db/routines/vn2008/views/edi_feature.sql deleted file mode 100644 index 7789eac06..000000000 --- a/db/routines/vn2008/views/edi_feature.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_feature` -AS SELECT `edi`.`feature`.`item_id` AS `item_id`, - `edi`.`feature`.`feature_type_id` AS `feature_type_id`, - `edi`.`feature`.`feature_value` AS `feature_value`, - `edi`.`feature`.`entry_date` AS `entry_date`, - `edi`.`feature`.`expiry_date` AS `expiry_date`, - `edi`.`feature`.`change_date_time` AS `change_date_time` -FROM `edi`.`feature` diff --git a/db/routines/vn2008/views/edi_genus.sql b/db/routines/vn2008/views/edi_genus.sql deleted file mode 100644 index c87ef2243..000000000 --- a/db/routines/vn2008/views/edi_genus.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_genus` -AS SELECT `edi`.`genus`.`genus_id` AS `genus_id`, - `edi`.`genus`.`latin_genus_name` AS `latin_genus_name`, - `edi`.`genus`.`entry_date` AS `entry_date`, - `edi`.`genus`.`expiry_date` AS `expiry_date`, - `edi`.`genus`.`change_date_time` AS `change_date_time` -FROM `edi`.`genus` diff --git a/db/routines/vn2008/views/edi_item_feature.sql b/db/routines/vn2008/views/edi_item_feature.sql deleted file mode 100644 index 216bd7cf6..000000000 --- a/db/routines/vn2008/views/edi_item_feature.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_item_feature` -AS SELECT `edi`.`item_feature`.`item_id` AS `item_id`, - `edi`.`item_feature`.`presentation_order` AS `presentation_order`, - `edi`.`item_feature`.`feature` AS `feature`, - `edi`.`item_feature`.`regulation_type` AS `regulation_type`, - `edi`.`item_feature`.`entry_date` AS `entry_date`, - `edi`.`item_feature`.`expiry_date` AS `expiry_date`, - `edi`.`item_feature`.`change_date_time` AS `change_date_time` -FROM `edi`.`item_feature` diff --git a/db/routines/vn2008/views/edi_plant.sql b/db/routines/vn2008/views/edi_plant.sql deleted file mode 100644 index 3537998db..000000000 --- a/db/routines/vn2008/views/edi_plant.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_plant` -AS SELECT `edi`.`plant`.`plant_id` AS `plant_id`, - `edi`.`plant`.`genus_id` AS `genus_id`, - `edi`.`plant`.`specie_id` AS `specie_id`, - `edi`.`plant`.`entry_date` AS `entry_date`, - `edi`.`plant`.`expiry_date` AS `expiry_date`, - `edi`.`plant`.`change_date_time` AS `change_date_time` -FROM `edi`.`plant` diff --git a/db/routines/vn2008/views/edi_type.sql b/db/routines/vn2008/views/edi_type.sql deleted file mode 100644 index 95d73a1ff..000000000 --- a/db/routines/vn2008/views/edi_type.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_type` -AS SELECT `edi`.`type`.`type_id` AS `type_id`, - `edi`.`type`.`type_group_id` AS `type_group_id`, - `edi`.`type`.`description` AS `description`, - `edi`.`type`.`entry_date` AS `entry_date`, - `edi`.`type`.`expiry_date` AS `expiry_date`, - `edi`.`type`.`change_date_time` AS `change_date_time` -FROM `edi`.`type` diff --git a/db/routines/vn2008/views/edi_value.sql b/db/routines/vn2008/views/edi_value.sql deleted file mode 100644 index 27829aa9e..000000000 --- a/db/routines/vn2008/views/edi_value.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`edi_value` -AS SELECT `edi`.`value`.`type_id` AS `type_id`, - `edi`.`value`.`type_value` AS `type_value`, - `edi`.`value`.`type_description` AS `type_description`, - `edi`.`value`.`entry_date` AS `entry_date`, - `edi`.`value`.`expiry_date` AS `expiry_date`, - `edi`.`value`.`change_date_time` AS `change_date_time` -FROM `edi`.`value` diff --git a/db/routines/vn2008/views/escritos.sql b/db/routines/vn2008/views/escritos.sql deleted file mode 100644 index b99bc13d7..000000000 --- a/db/routines/vn2008/views/escritos.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`escritos` -AS SELECT `s`.`id` AS `id`, - `s`.`code` AS `abrev`, - `s`.`description` AS `descripcion`, - `s`.`isVisible` AS `visible`, - `s`.`hasCompany` AS `hasCompany` -FROM `vn`.`sample` `s` diff --git a/db/routines/vn2008/views/person_user.sql b/db/routines/vn2008/views/person_user.sql deleted file mode 100644 index 1fb470c88..000000000 --- a/db/routines/vn2008/views/person_user.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`person_user` -AS SELECT `u`.`id` AS `id`, - `u`.`role` AS `mysql_user_id`, - `u`.`name` AS `name`, - `u`.`password` AS `password`, - `u`.`active` AS `active`, - `u`.`lastPassChange` AS `last_pass_change` -FROM `account`.`user` `u` diff --git a/db/routines/vn2008/views/person_user_idtrabajador.sql b/db/routines/vn2008/views/person_user_idtrabajador.sql deleted file mode 100644 index 1eb45f464..000000000 --- a/db/routines/vn2008/views/person_user_idtrabajador.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`person_user_idtrabajador` -AS SELECT `t`.`Id_Trabajador` AS `Id_Trabajador` -FROM ( - `vn2008`.`person_user` `p` - JOIN `vn2008`.`Trabajadores` `t` ON(`p`.`id` = `t`.`user_id`) - ) -WHERE `t`.`user_id` = `account`.`myUser_getId`() diff --git a/db/routines/vn2008/views/promissoryNote.sql b/db/routines/vn2008/views/promissoryNote.sql new file mode 100644 index 000000000..0db0fa86f --- /dev/null +++ b/db/routines/vn2008/views/promissoryNote.sql @@ -0,0 +1,8 @@ +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Pagares` +AS SELECT `p`.`id` AS `Id_Pagare`, + `p`.`issued` AS `Fechaemision`, + `p`.`Concept` AS `Concepto`, + `p`.`paymentFk` AS `pago_id` +FROM `vn`.`promissoryNote` `p` \ No newline at end of file diff --git a/db/routines/vn2008/views/reference_min.sql b/db/routines/vn2008/views/reference_min.sql deleted file mode 100644 index d40ae12a3..000000000 --- a/db/routines/vn2008/views/reference_min.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`reference_min` -AS SELECT `rc`.`dated` AS `date`, - `rc`.`value` AS `rate`, - `rc`.`currencyFk` AS `moneda_id` -FROM `vn`.`referenceCurrent` `rc` diff --git a/db/routines/vn2008/views/v_compres.sql b/db/routines/vn2008/views/v_compres.sql index 8c52e2a72..8bd6a4a64 100644 --- a/db/routines/vn2008/views/v_compres.sql +++ b/db/routines/vn2008/views/v_compres.sql @@ -53,7 +53,7 @@ AS SELECT `TP`.`Id_Tipo` AS `Familia`, `A`.`Color` AS `Color`, `A`.`Min` AS `Min`, `C`.`Costefijo` + `C`.`Embalajefijo` + `C`.`Comisionfija` + `C`.`Portefijo` AS `Coste`, - `W_OUT`.`fuente` AS `fuente`, + `W_OUT`.`isFeedStock` AS `fuente`, IF( `cb`.`Volumen` > 0, `cb`.`Volumen`, @@ -73,9 +73,9 @@ FROM ( ) JOIN `vn2008`.`travel` `TR` ON(`TR`.`id` = `E`.`travel_id`) ) - JOIN `vn2008`.`warehouse` `W_IN` ON(`W_IN`.`id` = `TR`.`warehouse_id`) + JOIN `vn`.`warehouse` `W_IN` ON(`W_IN`.`id` = `TR`.`warehouse_id`) ) - JOIN `vn2008`.`warehouse` `W_OUT` ON(`W_OUT`.`id` = `TR`.`warehouse_id_out`) + JOIN `vn`.`warehouse` `W_OUT` ON(`W_OUT`.`id` = `TR`.`warehouse_id_out`) ) JOIN `vn2008`.`Articles` `A` ON(`C`.`Id_Article` = `A`.`Id_Article`) ) @@ -85,6 +85,6 @@ FROM ( ) JOIN `vn2008`.`Cubos` `cb` ON(`cb`.`Id_Cubo` = `C`.`Id_Cubo`) ) -WHERE `W_IN`.`fuente` = 0 +WHERE `W_IN`.`isFeedStock` = 0 AND `E`.`Inventario` = 0 AND `E`.`Redada` = 0 diff --git a/db/routines/vn2008/views/v_ventes.sql b/db/routines/vn2008/views/v_ventes.sql deleted file mode 100644 index 9fd87a002..000000000 --- a/db/routines/vn2008/views/v_ventes.sql +++ /dev/null @@ -1,68 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`v_ventes` -AS SELECT `Agencias`.`Agencia` AS `Agencia`, - `A`.`Categoria` AS `Categoria`, - `A`.`tipo_id` AS `tipo_id`, - `A`.`Medida` AS `Medida`, - `A`.`Article` AS `Article`, - `A`.`Color` AS `Color`, - `CS`.`Id_cliente` AS `Id_Cliente`, - `TP`.`Id_Tipo` AS `Tipo`, - `T`.`Factura` AS `Factura`, - `T`.`warehouse_id` AS `warehouse_id`, - `M`.`Id_Movimiento` AS `Id_Movimiento`, - `M`.`Id_Article` AS `Id_Article`, - `TP`.`Id_Tipo` AS `Familia`, - `M`.`Id_Ticket` AS `Id_Ticket`, - `M`.`Concepte` AS `Concepte`, - `M`.`Cantidad` AS `Cantidad`, - `M`.`quantity` AS `quantity`, - `M`.`Preu` AS `Preu`, - `M`.`Descuento` AS `Descuento`, - IF( - `T`.`Fecha` >= '2015-10-01', - `M`.`CostFixat`, - `M`.`Preu` * (100 - `M`.`Descuento`) / 100 - ) AS `CostFixat`, - `M`.`Reservado` AS `Reservado`, - `M`.`OK` AS `OK`, - `M`.`PrecioFijado` AS `PrecioFijado`, - `M`.`odbc_date` AS `odbc_date`, - cast(`T`.`Fecha` AS date) AS `Fecha`, - `T`.`Fecha` AS `FechaCompleta`, - `CS`.`consignatario` AS `Alias`, - `T`.`Id_Consigna` AS `Id_Consigna`, - `M`.`Cantidad` * `M`.`Preu` * (100 - `M`.`Descuento`) / 100 AS `Importe`, - `O`.`Origen` AS `Origen`, - `TP`.`reino_id` AS `reino_id`, - `C`.`invoice` AS `invoice`, - `A`.`producer_id` AS `producer_id` -FROM ( - ( - ( - ( - ( - ( - ( - ( - `vn2008`.`Movimientos` `M` - JOIN `vn2008`.`Tickets` `T` ON(`M`.`Id_Ticket` = `T`.`Id_Ticket`) - ) - JOIN `vn2008`.`Consignatarios` `CS` ON(`CS`.`id_consigna` = `T`.`Id_Consigna`) - ) - JOIN `vn2008`.`Clientes` `C` ON(`CS`.`Id_cliente` = `C`.`id_cliente`) - ) - JOIN `vn2008`.`Articles` `A` ON(`M`.`Id_Article` = `A`.`Id_Article`) - ) - JOIN `vn2008`.`Origen` `O` ON(`O`.`id` = `A`.`id_origen`) - ) - JOIN `vn2008`.`Tipos` `TP` ON(`A`.`tipo_id` = `TP`.`tipo_id`) - ) - JOIN `vn2008`.`reinos` `r` ON(`TP`.`reino_id` = `r`.`id`) - ) - JOIN `vn2008`.`Agencias` ON(`Agencias`.`Id_Agencia` = `T`.`Id_Agencia`) - ) -WHERE `T`.`Fecha` >= '2013-01-01' - AND `C`.`real` > 0 - AND `r`.`id` <> 6 diff --git a/db/routines/vn2008/views/v_xsubcuentas.sql b/db/routines/vn2008/views/v_xsubcuentas.sql deleted file mode 100644 index a200e4ad9..000000000 --- a/db/routines/vn2008/views/v_xsubcuentas.sql +++ /dev/null @@ -1,207 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`v_xsubcuentas` -AS SELECT `Clientes`.`Cuenta` AS `COD`, - `Clientes`.`razonSocial` AS `TITULO`, - concat( - IF( - `p`.`CEE` = 1 - AND ascii(left(`Clientes`.`if`, 1)) < 58, - `p`.`Codigo`, - '' - ), - `Clientes`.`if` - ) AS `NIF`, - `Clientes`.`domicilio` AS `DOMICILIO`, - `Clientes`.`poblacion` AS `POBLACION`, - `province`.`name` AS `PROVINCIA`, - `Clientes`.`codPostal` AS `CODPOSTAL`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `Clientes`.`e-mail`, - 1, - coalesce(nullif(locate(',', `Clientes`.`e-mail`), 0), 99) - 1 - ) AS `EMAIL`, - IF( - `p`.`CEE` = 0 - OR `p`.`CEE` = 1 - AND `Clientes`.`vies` = 0, - 1, - IF( - `p`.`CEE` = 1 - AND `Clientes`.`vies` <> 0, - 2, - 4 - ) - ) AS `IDNIF` -FROM ( - ( - ( - `vn2008`.`Clientes` - JOIN ( - SELECT DISTINCT `Facturas`.`Id_Cliente` AS `Id_Cliente`, - `Facturas`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`Facturas` - WHERE `Facturas`.`Fecha` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH - UNION - SELECT `Recibos`.`Id_Cliente` AS `Id_Cliente`, - `Recibos`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`Recibos` - WHERE `Recibos`.`Fechacobro` > `util`.`VN_CURDATE`() + INTERVAL -2 MONTH - ) sub ON( - `Clientes`.`id_cliente` = sub.`Id_Cliente` - ) - ) - LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Clientes`.`Id_Pais`) - ) - JOIN `vn2008`.`province` ON( - `Clientes`.`province_id` = `province`.`province_id` - ) - ) -GROUP BY `Clientes`.`id_cliente`, - sub.`empresa_id` -UNION ALL -SELECT `Proveedores`.`cuenta` AS `Cuenta`, - `Proveedores`.`Proveedor` AS `Proveedor`, - concat( - IF( - `p`.`CEE` = 1 - AND ascii(left(`Proveedores`.`NIF`, 1)) < 58, - `p`.`Codigo`, - '' - ), - `Proveedores`.`NIF` - ) AS `NIF`, - `Proveedores`.`Domicilio` AS `Domicilio`, - `Proveedores`.`Localidad` AS `Localidad`, - `prov`.`name` AS `Provincia`, - `Proveedores`.`codpos` AS `CP`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `c`.`email`, - 1, - coalesce(nullif(locate(',', `c`.`email`), 0), 99) - 1 - ) AS `EMAIL`, - IF(`p`.`CEE` = 0, 1, IF(`p`.`CEE` = 1, 2, 4)) AS `IDNIF` -FROM ( - ( - ( - ( - `vn2008`.`Proveedores` - JOIN ( - SELECT `recibida`.`proveedor_id` AS `proveedor_id`, - `recibida`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`recibida` - WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH - GROUP BY `recibida`.`proveedor_id`, - `recibida`.`empresa_id` - UNION ALL - SELECT `pago`.`id_proveedor` AS `id_proveedor`, - `pago`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`pago` - WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH - GROUP BY `pago`.`id_proveedor`, - `pago`.`empresa_id` - ) sub ON( - `Proveedores`.`Id_Proveedor` = sub.`proveedor_id` - ) - ) - LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) - ) - LEFT JOIN `vn2008`.`province` `prov` ON( - `prov`.`province_id` = `Proveedores`.`province_id` - ) - ) - LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) - ) -WHERE `Proveedores`.`oficial` <> 0 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` -UNION ALL -SELECT `Gastos`.`Id_Gasto` COLLATE utf8mb3_unicode_ci AS `Id_Gasto`, - `Gastos`.`Gasto` COLLATE utf8mb3_unicode_ci AS `Gasto`, - NULL AS `NULL`, - NULL AS `My_exp_NULL`, - NULL AS `My_exp_1_NULL`, - NULL AS `My_exp_2_NULL`, - NULL AS `My_exp_3_NULL`, - NULL AS `country_code`, - `e`.`id` AS `id`, - NULL AS `EMAIL`, - 1 AS `IDNIF` -FROM ( - `vn2008`.`Gastos` - JOIN `vn2008`.`empresa` `e` ON(`e`.`id` = 442) - ) -UNION ALL -SELECT `Bancos`.`Cuenta` AS `Cuenta`, - `Bancos`.`Banco` AS `Banco`, - NULL AS `NULL`, - NULL AS `My_exp_NULL`, - NULL AS `My_exp_1_NULL`, - NULL AS `My_exp_2_NULL`, - NULL AS `My_exp_3_NULL`, - NULL AS `country_code`, - `e`.`id` AS `id`, - NULL AS `EMAIL`, - 1 AS `IDNIF` -FROM ( - `vn2008`.`Bancos` - JOIN `vn2008`.`empresa` `e` ON(`e`.`id` = 442) - ) -UNION ALL -SELECT lpad(right(`Proveedores`.`cuenta`, 5), 10, '47510000') AS `Cuenta`, - `Proveedores`.`Proveedor` AS `Proveedor`, - `Proveedores`.`NIF` AS `NIF`, - `Proveedores`.`Domicilio` AS `Domicilio`, - `Proveedores`.`Localidad` AS `Localidad`, - `prov`.`name` AS `Provincia`, - `Proveedores`.`codpos` AS `CP`, - `p`.`Codigo` AS `country_code`, - sub.`empresa_id` AS `empresa_id`, - substr( - `c`.`email`, - 1, - coalesce(nullif(locate(',', `c`.`email`), 0), 99) - 1 - ) AS `EMAIL`, - IF(`p`.`CEE` = 0, 1, IF(`p`.`CEE` = 1, 2, 4)) AS `IDNIF` -FROM ( - ( - ( - ( - `vn2008`.`Proveedores` - JOIN ( - SELECT `recibida`.`proveedor_id` AS `proveedor_id`, - `recibida`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`recibida` - WHERE `recibida`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH - GROUP BY `recibida`.`proveedor_id`, - `recibida`.`empresa_id` - UNION ALL - SELECT `pago`.`id_proveedor` AS `id_proveedor`, - `pago`.`empresa_id` AS `empresa_id` - FROM `vn2008`.`pago` - WHERE `pago`.`fecha` > `util`.`VN_CURDATE`() + INTERVAL -3 MONTH - GROUP BY `pago`.`id_proveedor`, - `pago`.`empresa_id` - ) sub ON( - `Proveedores`.`Id_Proveedor` = sub.`proveedor_id` - ) - ) - LEFT JOIN `vn2008`.`Paises` `p` ON(`p`.`Id` = `Proveedores`.`pais_id`) - ) - LEFT JOIN `vn2008`.`province` `prov` ON( - `prov`.`province_id` = `Proveedores`.`province_id` - ) - ) - LEFT JOIN `vn`.`supplierContact` `c` ON(`c`.`supplierFk` = `Proveedores`.`Id_Proveedor`) - ) -WHERE ( - `Proveedores`.`cuenta` LIKE '_____3____' - OR `Proveedores`.`cuenta` LIKE '_____2____' - ) - AND `Proveedores`.`oficial` = 1 -GROUP BY sub.`proveedor_id`, - sub.`empresa_id` diff --git a/db/routines/vn2008/views/versiones.sql b/db/routines/vn2008/views/versiones.sql deleted file mode 100644 index 04e63dbb4..000000000 --- a/db/routines/vn2008/views/versiones.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`versiones` -AS SELECT `m`.`app` AS `programa`, - `m`.`version` AS `version`, - 0 AS `critical` -FROM `vn`.`mdbVersion` `m` -WHERE `m`.`branchFk` = 'master' diff --git a/db/routines/vn2008/views/warehouse.sql b/db/routines/vn2008/views/warehouse.sql deleted file mode 100644 index 5199d5c8e..000000000 --- a/db/routines/vn2008/views/warehouse.sql +++ /dev/null @@ -1,21 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`warehouse` -AS SELECT `w`.`id` AS `id`, - `w`.`name` AS `name`, - `w`.`isInventory` AS `inventario`, - `w`.`isFeedStock` AS `fuente`, - `w`.`isComparative` AS `is_comparative`, - `w`.`hasComission` AS `comisionantes`, - `w`.`hasAvailable` AS `reserve`, - `w`.`isManaged` AS `isManaged`, - `w`.`isForTicket` AS `tpv`, - `w`.`hasStowaway` AS `hasStowaway`, - `w`.`hasDms` AS `hasDms`, - `w`.`addressName` AS `address_name`, - `w`.`delay` AS `delay`, - `w`.`countryFk` AS `Id_Paises`, - `w`.`labelZone` AS `zone_label`, - `w`.`valuatedInventory` AS `valuatedInventory`, - `w`.`hasConfectionTeam` AS `hasConfectionTeam` -FROM `vn`.`warehouse` `w` diff --git a/db/routines/vn2008/views/workerDocument.sql b/db/routines/vn2008/views/workerDocument.sql deleted file mode 100644 index 7aca7497f..000000000 --- a/db/routines/vn2008/views/workerDocument.sql +++ /dev/null @@ -1,8 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`workerDocument` -AS SELECT `vn`.`workerDocument`.`id` AS `id`, - `vn`.`workerDocument`.`worker` AS `worker`, - `vn`.`workerDocument`.`document` AS `document`, - `vn`.`workerDocument`.`isReadableByWorker` AS `isReadableByWorker` -FROM `vn`.`workerDocument` diff --git a/db/routines/vn2008/views/workerTeam.sql b/db/routines/vn2008/views/workerTeam.sql deleted file mode 100644 index 6db6c094a..000000000 --- a/db/routines/vn2008/views/workerTeam.sql +++ /dev/null @@ -1,7 +0,0 @@ -CREATE OR REPLACE DEFINER=`root`@`localhost` - SQL SECURITY DEFINER - VIEW `vn2008`.`workerTeam` -AS SELECT `wt`.`team` AS `team`, - `wt`.`id` AS `id`, - `wt`.`workerFk` AS `user` -FROM `vn`.`workerTeam` `wt` diff --git a/db/versions/10835-brownCarnation/00-firstScript.sql b/db/versions/10835-brownCarnation/00-firstScript.sql new file mode 100644 index 000000000..977e20905 --- /dev/null +++ b/db/versions/10835-brownCarnation/00-firstScript.sql @@ -0,0 +1,196 @@ +-- Place your SQL code here +-- Place your SQL code here +ALTER TABLE IF EXISTS vn2008.Agencias_province RENAME vn2008.Agencias_province__; +ALTER TABLE IF EXISTS vn2008.Agencias_province__ COMMENT='refs #6371 deprecated 2024-01-11'; + +ALTER TABLE IF EXISTS vn2008.Baldas RENAME vn2008.Baldas__; +ALTER TABLE IF EXISTS vn2008.Baldas__ COMMENT='refs #6371 deprecated 2024-01-11'; + +ALTER TABLE IF EXISTS vn2008.Brasa RENAME vn2008.Brasa__; +ALTER TABLE IF EXISTS vn2008.Brasa__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Clases +ALTER TABLE IF EXISTS vn2008.Clases RENAME vn2008.Clases__; +ALTER TABLE IF EXISTS vn2008.Clases__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Clientes_dits +ALTER TABLE IF EXISTS vn2008.Clientes_dits RENAME vn2008.Clientes_dits__; +ALTER TABLE IF EXISTS vn2008.Clientes_dits__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Clientes_empresa +ALTER TABLE IF EXISTS vn2008.Clientes_empresa RENAME vn2008.Clientes_empresa__; +ALTER TABLE IF EXISTS vn2008.Clientes_empresa__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Clientes_event +ALTER TABLE IF EXISTS vn2008.Clientes_event RENAME vn2008.Clientes_event__; +ALTER TABLE IF EXISTS vn2008.Clientes_event__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Clientes_potenciales +ALTER TABLE IF EXISTS vn2008.Clientes_potenciales RENAME vn2008.Clientes_potenciales__; +ALTER TABLE IF EXISTS vn2008.Clientes_potenciales__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Compres_ok +ALTER TABLE IF EXISTS vn2008.Compres_ok RENAME vn2008.Compres_ok__; +ALTER TABLE IF EXISTS vn2008.Compres_ok__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Consignatarios_devices +ALTER TABLE IF EXISTS vn2008.Consignatarios_devices RENAME vn2008.Consignatarios_devices__; +ALTER TABLE IF EXISTS vn2008.Consignatarios_devices__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Conteo +ALTER TABLE IF EXISTS vn2008.Conteo RENAME vn2008.Conteo__; +ALTER TABLE IF EXISTS vn2008.Conteo__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Entradas_kop +ALTER TABLE IF EXISTS vn2008.Entradas_kop RENAME vn2008.Entradas_kop__; +ALTER TABLE IF EXISTS vn2008.Entradas_kop__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Espionajes +ALTER TABLE IF EXISTS vn2008.Espionajes RENAME vn2008.Espionajes__; +ALTER TABLE IF EXISTS vn2008.Espionajes__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Estados +ALTER TABLE IF EXISTS vn2008.Estados RENAME vn2008.Estados__; +ALTER TABLE IF EXISTS vn2008.Estados__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Familias +ALTER TABLE IF EXISTS vn2008.Familias RENAME vn2008.Familias__; +ALTER TABLE IF EXISTS vn2008.Familias__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Forms +ALTER TABLE IF EXISTS vn2008.Forms RENAME vn2008.Forms__; +ALTER TABLE IF EXISTS vn2008.Forms__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Grupos +ALTER TABLE IF EXISTS vn2008.Grupos RENAME vn2008.Grupos__; +ALTER TABLE IF EXISTS vn2008.Grupos__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Informes +ALTER TABLE IF EXISTS vn2008.Informes RENAME vn2008.Informes__; +ALTER TABLE IF EXISTS vn2008.Informes__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla MoniRENAMEring +ALTER TABLE IF EXISTS vn2008.MoniRENAMEring RENAME vn2008.MoniRENAMEring__; +ALTER TABLE IF EXISTS vn2008.MoniRENAMEring__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla MovimienRENAMEs_avisar +ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_avisar RENAME vn2008.MovimienRENAMEs_avisar__; +ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_avisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla MovimienRENAMEs_revisar +ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar RENAME vn2008.MovimienRENAMEs_revisar__; +ALTER TABLE IF EXISTS vn2008.MovimienRENAMEs_revisar__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Proveedores_cargueras +ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras RENAME vn2008.Proveedores_cargueras__; +ALTER TABLE IF EXISTS vn2008.Proveedores_cargueras__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Proveedores_comunicados +ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados RENAME vn2008.Proveedores_comunicados__; +ALTER TABLE IF EXISTS vn2008.Proveedores_comunicados__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Proveedores_escriRENAMEs +ALTER TABLE IF EXISTS vn2008.Proveedores_escriRENAMEs RENAME vn2008.Proveedores_escriRENAMEs__; +ALTER TABLE IF EXISTS vn2008.Proveedores_escriRENAMEs__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Tickets_stack +ALTER TABLE IF EXISTS vn2008.Tickets_stack RENAME vn2008.Tickets_stack__; +ALTER TABLE IF EXISTS vn2008.Tickets_stack__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Tipos_f11 +ALTER TABLE IF EXISTS vn2008.Tipos_f11 RENAME vn2008.Tipos_f11__; +ALTER TABLE IF EXISTS vn2008.Tipos_f11__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla Tramos +ALTER TABLE IF EXISTS vn2008.Tramos RENAME vn2008.Tramos__; +ALTER TABLE IF EXISTS vn2008.Tramos__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla accion_dits +ALTER TABLE IF EXISTS vn2008.accion_dits RENAME vn2008.accion_dits__; +ALTER TABLE IF EXISTS vn2008.accion_dits__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla agency_hour +ALTER TABLE IF EXISTS vn2008.agency_hour RENAME vn2008.agency_hour__; +ALTER TABLE IF EXISTS vn2008.agency_hour__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla agency_warehouse +ALTER TABLE IF EXISTS vn2008.agency_warehouse RENAME vn2008.agency_warehouse__; +ALTER TABLE IF EXISTS vn2008.agency_warehouse__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla call_information +ALTER TABLE IF EXISTS vn2008.call_information RENAME vn2008.call_information__; +ALTER TABLE IF EXISTS vn2008.call_information__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla call_option +ALTER TABLE IF EXISTS vn2008.call_option RENAME vn2008.call_option__; +ALTER TABLE IF EXISTS vn2008.call_option__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cl_dep +ALTER TABLE IF EXISTS vn2008.cl_dep RENAME vn2008.cl_dep__; +ALTER TABLE IF EXISTS vn2008.cl_dep__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cl_pet +ALTER TABLE IF EXISTS vn2008.cl_pet RENAME vn2008.cl_pet__; +ALTER TABLE IF EXISTS vn2008.cl_pet__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cl_que +ALTER TABLE IF EXISTS vn2008.cl_que RENAME vn2008.cl_que__; +ALTER TABLE IF EXISTS vn2008.cl_que__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla commission +ALTER TABLE IF EXISTS vn2008.commission RENAME vn2008.commission__; +ALTER TABLE IF EXISTS vn2008.commission__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla config_host_forms +ALTER TABLE IF EXISTS vn2008.config_host_forms RENAME vn2008.config_host_forms__; +ALTER TABLE IF EXISTS vn2008.config_host_forms__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla container +ALTER TABLE IF EXISTS vn2008.container RENAME vn2008.container__; +ALTER TABLE IF EXISTS vn2008.container__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cooler_path +ALTER TABLE IF EXISTS vn2008.cooler_path RENAME vn2008.cooler_path__; +ALTER TABLE IF EXISTS vn2008.cooler_path__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla credit_card +ALTER TABLE IF EXISTS vn2008.credit_card RENAME vn2008.credit_card__; +ALTER TABLE IF EXISTS vn2008.credit_card__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cyc +ALTER TABLE IF EXISTS vn2008.cyc RENAME vn2008.cyc__; +ALTER TABLE IF EXISTS vn2008.cyc__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla cyc_declaration +ALTER TABLE IF EXISTS vn2008.cyc_declaration RENAME vn2008.cyc_declaration__; +ALTER TABLE IF EXISTS vn2008.cyc_declaration__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla dock +ALTER TABLE IF EXISTS vn2008.dock RENAME vn2008.dock__; +ALTER TABLE IF EXISTS vn2008.dock__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla edi_testigos +ALTER TABLE IF EXISTS vn2008.edi_testigos RENAME vn2008.edi_testigos__; +ALTER TABLE IF EXISTS vn2008.edi_testigos__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla emp_day_pay +ALTER TABLE IF EXISTS vn2008.emp_day_pay RENAME vn2008.emp_day_pay__; +ALTER TABLE IF EXISTS vn2008.emp_day_pay__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla expeditions_deleted +ALTER TABLE IF EXISTS vn2008.expeditions_deleted RENAME vn2008.expeditions_deleted__; +ALTER TABLE IF EXISTS vn2008.expeditions_deleted__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla expeditions_pictures +ALTER TABLE IF EXISTS vn2008.expeditions_pictures RENAME vn2008.expeditions_pictures__; +ALTER TABLE IF EXISTS vn2008.expeditions_pictures__ COMMENT='refs #6371 deprecated 2024-01-11'; + +ALTER TABLE IF EXISTS vn2008.cp RENAME vn2008.cp__; +ALTER TABLE IF EXISTS vn2008.cp__ COMMENT='refs #6371 deprecated 2024-01-11'; + +ALTER TABLE IF EXISTS vn2008.duaDismissed RENAME vn2008.duaDismissed__; +ALTER TABLE IF EXISTS vn2008.duaDismissed__ COMMENT='refs #6371 deprecated 2024-01-11'; + +-- Para la tabla config +ALTER TABLE IF EXISTS vn2008.config RENAME vn2008.config__; +ALTER TABLE IF EXISTS vn2008.config__ COMMENT='refs #6371 deprecated 2024-01-11'; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/01-Bancos_poliza.sql b/db/versions/10835-brownCarnation/01-Bancos_poliza.sql new file mode 100644 index 000000000..5f7dbf565 --- /dev/null +++ b/db/versions/10835-brownCarnation/01-Bancos_poliza.sql @@ -0,0 +1,16 @@ +-- Bancos_poliza +DROP VIEW IF EXISTS vn.bankPolicy; + +ALTER TABLE IF EXISTS `vn2008`.`Bancos_poliza` RENAME `vn`.`bankPolicy`; + +ALTER TABLE IF EXISTS `vn`.`bankPolicy` +CHANGE COLUMN IF EXISTS `poliza_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `referencia` `ref` varchar(45) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `importe` `amount` double NOT NULL, +CHANGE COLUMN IF EXISTS `com_dispuesto` `committedFee` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `com_no_dispuesto` `nonCommittedFee` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `com_anual` `annualFee` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `apertura` `started` date NOT NULL, +CHANGE COLUMN IF EXISTS `cierre` `ended` date DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Banco` `accountingFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL DEFAULT 442; diff --git a/db/versions/10835-brownCarnation/03-Entradas_orden.sql b/db/versions/10835-brownCarnation/03-Entradas_orden.sql new file mode 100644 index 000000000..2f4429cda --- /dev/null +++ b/db/versions/10835-brownCarnation/03-Entradas_orden.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`Entradas_orden` RENAME `vn`.`entryOrder`; + +ALTER TABLE IF EXISTS `vn`.`entryOrder` +CHANGE COLUMN IF EXISTS `Id_Entrada` `entryFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `orden` `order` int(11) NOT NULL DEFAULT 1 COMMENT '1.- Ordenar por articulo\n2.- Ordenar por compra\n'; diff --git a/db/versions/10835-brownCarnation/04-Pagares.sql b/db/versions/10835-brownCarnation/04-Pagares.sql new file mode 100644 index 000000000..f87f426e0 --- /dev/null +++ b/db/versions/10835-brownCarnation/04-Pagares.sql @@ -0,0 +1,15 @@ +DROP VIEW IF EXISTS vn.promissoryNote; + +ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_Vencimiento; +ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_Importe; +ALTER TABLE IF EXISTS vn2008.Pagares DROP INDEX empresa_id; +ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_empresa_id; +ALTER TABLE IF EXISTS vn2008.Pagares DROP COLUMN kk_id_proveedor; + +ALTER TABLE IF EXISTS `vn2008`.`Pagares` RENAME `vn`.`promissoryNote`; + +ALTER TABLE IF EXISTS `vn`.`promissoryNote` +CHANGE COLUMN IF EXISTS `Fechaemision` `issued` timestamp NOT NULL DEFAULT current_timestamp(), +CHANGE COLUMN IF EXISTS `Id_Pagare` `id` int(11) NOT NULL AUTO_INCREMENT FIRST, +CHANGE COLUMN IF EXISTS `Concepto` `Concept` varchar(50) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `pago_id` `paymentFk` int(10) unsigned DEFAULT NULL; diff --git a/db/versions/10835-brownCarnation/05-Proveedores_gestdoc.sql b/db/versions/10835-brownCarnation/05-Proveedores_gestdoc.sql new file mode 100644 index 000000000..3450fe463 --- /dev/null +++ b/db/versions/10835-brownCarnation/05-Proveedores_gestdoc.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`Proveedores_gestdoc` RENAME `vn`.`supplierDms`; + +ALTER TABLE IF EXISTS `vn`.`supplierDms` +CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `gestdoc_id` `dmsFk` int(11) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/06-Remesas.sql b/db/versions/10835-brownCarnation/06-Remesas.sql new file mode 100644 index 000000000..ef4240365 --- /dev/null +++ b/db/versions/10835-brownCarnation/06-Remesas.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS `vn2008`.`Remesas` RENAME `vn`.`remittance`; + +ALTER TABLE IF EXISTS `vn`.`remittance` +CHANGE COLUMN IF EXISTS `Id_Remesa` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Fecha Remesa` `dated` datetime DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Banco` `accountingFk` int(11) DEFAULT 0, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL DEFAULT 442; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/07-Saldos_Prevision.sql b/db/versions/10835-brownCarnation/07-Saldos_Prevision.sql new file mode 100644 index 000000000..050b9a5ed --- /dev/null +++ b/db/versions/10835-brownCarnation/07-Saldos_Prevision.sql @@ -0,0 +1,10 @@ +ALTER TABLE IF EXISTS `vn2008`.`Saldos_Prevision` RENAME `vn`.`forecastedBalance`; + +ALTER TABLE IF EXISTS `vn`.`forecastedBalance` +CHANGE COLUMN IF EXISTS `Saldos_Prevision_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Descripcion` `description` varchar(45) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Importe` `amount` double NOT NULL DEFAULT 0, +CHANGE COLUMN IF EXISTS `Fecha` `dated` date NOT NULL, +CHANGE COLUMN IF EXISTS `Id_Banco` `accountingFk` int(11) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL DEFAULT 442; + diff --git a/db/versions/10835-brownCarnation/08-Series.sql b/db/versions/10835-brownCarnation/08-Series.sql new file mode 100644 index 000000000..e43ab0d5a --- /dev/null +++ b/db/versions/10835-brownCarnation/08-Series.sql @@ -0,0 +1,2 @@ +ALTER TABLE IF EXISTS vn2008.Series RENAME vn2008.Series__; +ALTER TABLE IF EXISTS vn2008.Series__ COMMENT='refs #6371 deprecated 2024-01-11'; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/09-Split_lines.sql b/db/versions/10835-brownCarnation/09-Split_lines.sql new file mode 100644 index 000000000..64186a978 --- /dev/null +++ b/db/versions/10835-brownCarnation/09-Split_lines.sql @@ -0,0 +1,7 @@ +ALTER TABLE IF EXISTS `vn2008`.`Split_lines` RENAME `vn`.`splitLine`; + +ALTER TABLE IF EXISTS `vn`.`splitLine` +CHANGE COLUMN IF EXISTS `Id_Split_lines` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Id_Split` `splitFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `Id_Article` `itemFk` int(11) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Compra` `buyFk` int(11) DEFAULT NULL; diff --git a/db/versions/10835-brownCarnation/10-Split.sql b/db/versions/10835-brownCarnation/10-Split.sql new file mode 100644 index 000000000..f8321c96e --- /dev/null +++ b/db/versions/10835-brownCarnation/10-Split.sql @@ -0,0 +1,8 @@ +ALTER TABLE IF EXISTS `vn2008`.`Splits` RENAME `vn`.`split`; + +ALTER TABLE IF EXISTS `vn`.`split` +CHANGE COLUMN IF EXISTS `Id_Split` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Id_Ticket` `ticketFk` int(11) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Entrada` `entryFk` int(11) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Fecha` `dated` datetime DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Notas` `note` varchar(255) DEFAULT NULL; diff --git a/db/versions/10835-brownCarnation/11-Vehiculos_consumo.sql b/db/versions/10835-brownCarnation/11-Vehiculos_consumo.sql new file mode 100644 index 000000000..7d7c8a8e8 --- /dev/null +++ b/db/versions/10835-brownCarnation/11-Vehiculos_consumo.sql @@ -0,0 +1,13 @@ +ALTER TABLE IF EXISTS `vn2008`.`Vehiculos_consumo` RENAME `vn`.`vehicleConsumption`; + +ALTER TABLE IF EXISTS `vn`.`vehicleConsumption` +CHANGE COLUMN IF EXISTS `Vehiculos_consumo_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Id_Vehiculo` `vehicleFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `fecha` `dated` date NOT NULL, +CHANGE COLUMN IF EXISTS `litros` `liters` double unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `precio` `price` double unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `peajes` `tolls` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `descuento` `discount` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `odbc_date` `created` timestamp NULL DEFAULT current_timestamp(), +CHANGE COLUMN IF EXISTS `otros` `others` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `proveedoresFk` `supplierFk` int(10) unsigned DEFAULT NULL; diff --git a/db/versions/10835-brownCarnation/12-account_conciliacion.sql b/db/versions/10835-brownCarnation/12-account_conciliacion.sql new file mode 100644 index 000000000..d8469e035 --- /dev/null +++ b/db/versions/10835-brownCarnation/12-account_conciliacion.sql @@ -0,0 +1,14 @@ +DROP TRIGGER IF EXISTS vn2008.account_conciliacion_BEFORE_INSERT; + +ALTER TABLE IF EXISTS `vn2008`.`account_conciliacion` RENAME `vn`.`accountReconciliation`; + +ALTER TABLE IF EXISTS `vn`.`accountReconciliation` +CHANGE COLUMN IF EXISTS `idaccount_conciliacion` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `Id_Proveedores_account` `supplierAccountFk` mediumint(8) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `Fechaoperacion` `operationDated` datetime NOT NULL, +CHANGE COLUMN IF EXISTS `FechaValor` `valueDated` datetime NOT NULL, +CHANGE COLUMN IF EXISTS `importe` `amount` double NOT NULL, +CHANGE COLUMN IF EXISTS `Concepto` `concept` varchar(255) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `DebeHaber` `debitCredit` smallint(6) NOT NULL, +CHANGE COLUMN IF EXISTS `id_calculated` `calculatedCode` varchar(255) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `odbc_date` `created` timestamp NULL DEFAULT current_timestamp(); diff --git a/db/versions/10835-brownCarnation/13-account_detail.sql b/db/versions/10835-brownCarnation/13-account_detail.sql new file mode 100644 index 000000000..c20e8e400 --- /dev/null +++ b/db/versions/10835-brownCarnation/13-account_detail.sql @@ -0,0 +1,6 @@ +ALTER TABLE IF EXISTS `vn2008`.`account_detail` RENAME `vn`.`accountDetail`; + +ALTER TABLE IF EXISTS `vn`.`accountDetail` +CHANGE COLUMN IF EXISTS `account_detail_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `account_detail_type_id` `accountDetailTypeFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `Id_Proveedores_account` `supplierAccountFk` mediumint(8) unsigned NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/14-account_detail_type.sql b/db/versions/10835-brownCarnation/14-account_detail_type.sql new file mode 100644 index 000000000..80be31d1b --- /dev/null +++ b/db/versions/10835-brownCarnation/14-account_detail_type.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`account_detail_type` RENAME `vn`.`accountDetailType`; + +ALTER TABLE IF EXISTS `vn`.`accountDetailType` +CHANGE COLUMN IF EXISTS `account_detail_type_id` `id` int(11) NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/15-agencia_descuadre.sql b/db/versions/10835-brownCarnation/15-agencia_descuadre.sql new file mode 100644 index 000000000..1085b74f6 --- /dev/null +++ b/db/versions/10835-brownCarnation/15-agencia_descuadre.sql @@ -0,0 +1,3 @@ +-- Para la tabla agencia_descuadre +ALTER TABLE IF EXISTS vn2008.agencia_descuadre RENAME vn2008.agencia_descuadre__; +ALTER TABLE IF EXISTS vn2008.agencia_descuadre__ COMMENT='refs #6371 deprecated 2024-01-11'; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/16-airline.sql b/db/versions/10835-brownCarnation/16-airline.sql new file mode 100644 index 000000000..301499174 --- /dev/null +++ b/db/versions/10835-brownCarnation/16-airline.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`airline` RENAME `vn`.`airline`; + +ALTER TABLE IF EXISTS `vn`.`airline` +CHANGE COLUMN IF EXISTS `airline_id` `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/17-airport.sql b/db/versions/10835-brownCarnation/17-airport.sql new file mode 100644 index 000000000..c6e2d3929 --- /dev/null +++ b/db/versions/10835-brownCarnation/17-airport.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`airport` RENAME `vn`.`airport`; + +ALTER TABLE IF EXISTS `vn`.`airport` +CHANGE COLUMN IF EXISTS `airport_id` `id` smallint(2) unsigned NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/18-albaran.sql b/db/versions/10835-brownCarnation/18-albaran.sql new file mode 100644 index 000000000..9635bb394 --- /dev/null +++ b/db/versions/10835-brownCarnation/18-albaran.sql @@ -0,0 +1,15 @@ +ALTER TABLE IF EXISTS `vn2008`.`albaran` RENAME `vn`.`deliveryNote`; + +ALTER TABLE IF EXISTS `vn`.`deliveryNote` +CHANGE COLUMN IF EXISTS `albaran_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `fecha` `shipped` date NOT NULL, +CHANGE COLUMN IF EXISTS `fecha_entrega` `landed` date DEFAULT NULL, +CHANGE COLUMN IF EXISTS `valor` `amount` double DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `warehouse_id` `warehouseFk` smallint(6) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `albaran_state_id` `stateFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `Id_Trabajador` `workerFk` int(10) unsigned NOT NULL COMMENT 'Id_Trabajador hace referencia a la persona que ha introducido el albarán', +CHANGE COLUMN IF EXISTS `Id_Responsable` `supervisorFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `department_id` `departmentFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `recibida_id` `invoiceInFk` mediumint(8) unsigned DEFAULT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/19-albaran_gestdoc.sql b/db/versions/10835-brownCarnation/19-albaran_gestdoc.sql new file mode 100644 index 000000000..68f1df29e --- /dev/null +++ b/db/versions/10835-brownCarnation/19-albaran_gestdoc.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`albaran_gestdoc` RENAME `vn`.`deliveryNoteDms`; + +ALTER TABLE IF EXISTS `vn`.`deliveryNoteDms` +CHANGE COLUMN IF EXISTS `gestdoc_id` `dmsFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `albaran_id` `deliveryNoteFk` int(11) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/20-albaran_state.sql b/db/versions/10835-brownCarnation/20-albaran_state.sql new file mode 100644 index 000000000..607ffb869 --- /dev/null +++ b/db/versions/10835-brownCarnation/20-albaran_state.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`albaran_state` RENAME `vn`.`deliveryNoteState`; + +ALTER TABLE IF EXISTS `vn`.`deliveryNoteState` +CHANGE COLUMN IF EXISTS `albaran_state_id` `id`int(11) NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/21-awb_component.sql b/db/versions/10835-brownCarnation/21-awb_component.sql new file mode 100644 index 000000000..a53079444 --- /dev/null +++ b/db/versions/10835-brownCarnation/21-awb_component.sql @@ -0,0 +1,11 @@ +ALTER TABLE IF EXISTS `vn2008`.`awb_component` RENAME `vn`.`awbComponent`; + +ALTER TABLE IF EXISTS `vn`.`awbComponent` +CHANGE COLUMN IF EXISTS `awb_id` `awbFk` smallint(11) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Proveedor` `supplierFk` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `Fecha` `dated__` date NOT NULL, +CHANGE COLUMN IF EXISTS `awb_component_type_id` `typeFk` mediumint(3) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `awb_role_id` `awbRoleFk` tinyint(1) unsigned NOT NULL DEFAULT 1, +CHANGE COLUMN IF EXISTS `awb_unit_id` `awbUnitFk` varchar(10) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Moneda` `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2, +CHANGE COLUMN IF EXISTS `recibida_id` `invoiceInFk` mediumint(8) unsigned DEFAULT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/22-awb_component_template.sql b/db/versions/10835-brownCarnation/22-awb_component_template.sql new file mode 100644 index 000000000..78ae4cb19 --- /dev/null +++ b/db/versions/10835-brownCarnation/22-awb_component_template.sql @@ -0,0 +1,15 @@ +ALTER TABLE IF EXISTS `vn2008`.`awb_component_template` RENAME `vn`.`awbComponentTemplate`; + +ALTER TABLE IF EXISTS `vn`.`awbComponentTemplate` +CHANGE COLUMN IF EXISTS `awb_component_template_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `carguera_id` `freightFk` int(11) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `airport_in` `airportIn` varchar(3) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `airport_out` `airportOut` varchar(3) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `airline_id` `airlineFk` smallint(2) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `awb_component_type_id` `typeFk` mediumint(3) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `Fecha` `dated` date NOT NULL, +CHANGE COLUMN IF EXISTS `awb_role_id` `awbRoleFk` tinyint(1) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `awb_unit_id` `awbUnit` varchar(10) DEFAULT NULL, +CHANGE COLUMN IF EXISTS `max_value` `maxValue` decimal(10,2) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `min_value` `minValue` decimal(10,2) unsigned DEFAULT NULL, +CHANGE COLUMN IF EXISTS `Id_Moneda` `currencyFk` tinyint(3) unsigned NOT NULL DEFAULT 2 \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/23-awb_component_type.sql b/db/versions/10835-brownCarnation/23-awb_component_type.sql new file mode 100644 index 000000000..85f4fb753 --- /dev/null +++ b/db/versions/10835-brownCarnation/23-awb_component_type.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`awb_component_type` RENAME `vn`.`awbComponentType`; + +ALTER TABLE IF EXISTS `vn`.`awbComponentType` +CHANGE COLUMN IF EXISTS `awb_component_type_id` `id` mediumint(3) unsigned NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/24-awb_gestdoc.sql b/db/versions/10835-brownCarnation/24-awb_gestdoc.sql new file mode 100644 index 000000000..15ac67195 --- /dev/null +++ b/db/versions/10835-brownCarnation/24-awb_gestdoc.sql @@ -0,0 +1,6 @@ +ALTER TABLE IF EXISTS `vn2008`.`awb_gestdoc` RENAME `vn`.`awbDms`; + +ALTER TABLE IF EXISTS `vn`.`awbDms` +CHANGE COLUMN IF EXISTS `awb_gestdoc_id` `id` int(11) NOT NULL AUTO_INCREMENT, +CHANGE COLUMN IF EXISTS `awb_id` `awbFk` smallint(11) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `gestdoc_id` `dmsFk` int(11) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/25-awb_recibida.sql b/db/versions/10835-brownCarnation/25-awb_recibida.sql new file mode 100644 index 000000000..e403775c9 --- /dev/null +++ b/db/versions/10835-brownCarnation/25-awb_recibida.sql @@ -0,0 +1,8 @@ +DROP TRIGGER IF EXISTS vn2008.awb_recibida_ad; + +ALTER TABLE IF EXISTS `vn2008`.`awb_recibida` RENAME `vn`.`awbInvoiceIn`; + +ALTER TABLE IF EXISTS `vn`.`awbInvoiceIn` +CHANGE COLUMN IF EXISTS `awb_id` `awbFk` smallint(5) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `recibida_id` `invoiceInFk` mediumint(8) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `dua` `sad` varchar(18) DEFAULT NULL; diff --git a/db/versions/10835-brownCarnation/26-awb_role.sql b/db/versions/10835-brownCarnation/26-awb_role.sql new file mode 100644 index 000000000..eb0e5594b --- /dev/null +++ b/db/versions/10835-brownCarnation/26-awb_role.sql @@ -0,0 +1,4 @@ +ALTER TABLE IF EXISTS `vn2008`.`awb_role` RENAME `vn`.`awbRole`; + +ALTER TABLE IF EXISTS `vn`.`awbRole` +CHANGE COLUMN IF EXISTS `awb_role_id` `id` tinyint(1) unsigned NOT NULL AUTO_INCREMENT; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/27-awb_unit.sql b/db/versions/10835-brownCarnation/27-awb_unit.sql new file mode 100644 index 000000000..1ddf71b6d --- /dev/null +++ b/db/versions/10835-brownCarnation/27-awb_unit.sql @@ -0,0 +1,4 @@ +ALTER TABLE `vn2008`.`awb_unit` RENAME `vn`.`awbUnit`; + +ALTER TABLE IF EXISTS `vn`.`awbUnit` +CHANGE COLUMN IF EXISTS `awb_unit_id` `id` varchar(10) NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/28-balance_nest_tree.sql b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql new file mode 100644 index 000000000..043bde2e4 --- /dev/null +++ b/db/versions/10835-brownCarnation/28-balance_nest_tree.sql @@ -0,0 +1,14 @@ +ALTER TABLE IF EXISTS `vn2008`.`balance_nest_tree` RENAME `vn`.`balanceNestTree`; + +ALTER TABLE IF EXISTS `vn`.`balanceNestTree` +CHANGE COLUMN IF EXISTS `Id_Gasto` `expenseFk` varchar(10) DEFAULT NULL; + +ALTER TABLE vn.balanceNestTree + MODIFY COLUMN IF EXISTS expenseFk varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL; + +UPDATE vn.balanceNestTree + SET expenseFk = NULL + WHERE expenseFk =''; + +ALTER TABLE IF EXISTS vn.balanceNestTree ADD CONSTRAINT balanceNestTree_expense_FK + FOREIGN KEY (expenseFk) REFERENCES vn.expense(id) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/db/versions/10835-brownCarnation/29-buy_edi_k012.sql b/db/versions/10835-brownCarnation/29-buy_edi_k012.sql new file mode 100644 index 000000000..78b1123a5 --- /dev/null +++ b/db/versions/10835-brownCarnation/29-buy_edi_k012.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`buy_edi_k012` RENAME `edi`.`ektK1`; + +ALTER TABLE IF EXISTS `edi`.`ektK1` +CHANGE COLUMN IF EXISTS `buy_edi_k012_id` `id` smallint(6) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `description` `description` varchar(50) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/30-buy_edi_k03.sql b/db/versions/10835-brownCarnation/30-buy_edi_k03.sql new file mode 100644 index 000000000..41d453274 --- /dev/null +++ b/db/versions/10835-brownCarnation/30-buy_edi_k03.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`buy_edi_k03` RENAME `edi`.`ektK3`; + +ALTER TABLE IF EXISTS `edi`.`ektK3` +CHANGE COLUMN IF EXISTS `buy_edi_k03_id` `id` smallint(6) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `description` `description` varchar(50) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/31-buy_edi_k04.sql b/db/versions/10835-brownCarnation/31-buy_edi_k04.sql new file mode 100644 index 000000000..7174f34e0 --- /dev/null +++ b/db/versions/10835-brownCarnation/31-buy_edi_k04.sql @@ -0,0 +1,5 @@ +ALTER TABLE IF EXISTS `vn2008`.`buy_edi_k04` RENAME `edi`.`ektK4`; + +ALTER TABLE IF EXISTS `edi`.`ektK4` +CHANGE COLUMN IF EXISTS `buy_edi_k04_id` `id` smallint(6) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `description` `description` varchar(50) NOT NULL; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/32-definitivo.sql b/db/versions/10835-brownCarnation/32-definitivo.sql new file mode 100644 index 000000000..3628137f3 --- /dev/null +++ b/db/versions/10835-brownCarnation/32-definitivo.sql @@ -0,0 +1,13 @@ +ALTER TABLE IF EXISTS `vn2008`.`definitivo` RENAME `vn`.`dmsStorageBox`; + +ALTER TABLE IF EXISTS `vn`.`dmsStorageBox` +CHANGE COLUMN IF EXISTS `definitivo_id` `id` int(11) NOT NULL, +CHANGE COLUMN IF EXISTS `empresa_id` `companyFk` int(10) unsigned NOT NULL, +CHANGE COLUMN IF EXISTS `desde` `started` bigint(20) NOT NULL, +CHANGE COLUMN IF EXISTS `hasta` `ended` bigint(20) NOT NULL, +CHANGE COLUMN IF EXISTS `fecha` `created` timestamp NOT NULL DEFAULT current_timestamp(); + +ALTER TABLE IF EXISTS `vn`.`dmsStorageBox` COMMENT='Caja en la que se guardan la documentacion fisica de dms'; + +ALTER TABLE IF EXISTS vn.dmsStorageBox ADD CONSTRAINT dmsStorageBox_company_FK + FOREIGN KEY (companyFk) REFERENCES vn.company(id); \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/33-dropTables.sql b/db/versions/10835-brownCarnation/33-dropTables.sql new file mode 100644 index 000000000..557d81623 --- /dev/null +++ b/db/versions/10835-brownCarnation/33-dropTables.sql @@ -0,0 +1,19 @@ +DROP TABLE IF EXISTS vn2008.Colores__; + +DROP TABLE IF EXISTS vn2008.Comparativa__; + +DROP TABLE IF EXISTS vn2008.`Enlaces Facturas__`; + +DROP TABLE IF EXISTS vn2008.Entradas_dits__; + +DROP TABLE IF EXISTS vn2008.Entradas_stack__; + +DROP TABLE IF EXISTS vn2008.Entradas_turno__; + +DROP TABLE IF EXISTS vn2008.EnvioMasivo__; + +DROP TABLE IF EXISTS vn2008.Estanterias__; + +DROP TABLE IF EXISTS vn2008.Estanterias_distri__; + +DROP TABLE IF EXISTS vn2008.Estanterias_distri_name__; \ No newline at end of file diff --git a/db/versions/10835-brownCarnation/34-permisos.sql b/db/versions/10835-brownCarnation/34-permisos.sql new file mode 100644 index 000000000..611207c61 --- /dev/null +++ b/db/versions/10835-brownCarnation/34-permisos.sql @@ -0,0 +1,274 @@ + +-- Bancos_poliza +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Bancos_poliza` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.Bancos_poliza TO `administrative`; +GRANT SELECT ON TABLE vn.bankPolicy TO `administrative`; + +-- Entradas_orden +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Entradas_orden` AS +SELECT 1; + +GRANT SELECT,INSERT,DELETE ON TABLE vn2008.Entradas_orden TO `buyer`; +GRANT SELECT,INSERT,DELETE ON TABLE vn.entryOrder TO `buyer`; + +-- Proveedores_gestdoc +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Proveedores_gestdoc` AS +SELECT 1; + +GRANT SELECT,INSERT,DELETE ON TABLE vn2008.Proveedores_gestdoc TO `administrative`; +GRANT SELECT ON TABLE vn2008.Proveedores_gestdoc TO `buyer`; +GRANT SELECT,INSERT ON TABLE vn2008.Proveedores_gestdoc TO `hr`; + +GRANT SELECT,INSERT,DELETE ON TABLE vn.supplierDms TO `administrative`; +GRANT SELECT ON TABLE vn.supplierDms TO `buyer`; +GRANT SELECT,INSERT ON TABLE vn.supplierDms TO `hr`; + +-- Remesas +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Remesas` AS +SELECT 1; + +GRANT SELECT,INSERT ON TABLE vn2008.Remesas TO `financial`; +GRANT SELECT,INSERT ON TABLE vn.remittance TO `financial`; + +-- Vehiculos_consumo +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`Vehiculos_consumo` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.Vehiculos_consumo TO `administrative`; +GRANT INSERT,UPDATE,DELETE ON TABLE vn2008.Vehiculos_consumo TO `productionAssi`; + +GRANT SELECT ON TABLE vn.vehicleConsumption TO `adminOfficer`; +GRANT INSERT,UPDATE,DELETE ON TABLE vn.vehicleConsumption TO `productionAssi`; + +-- account_conciliacion +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_conciliacion` AS +SELECT 1; + +GRANT SELECT,INSERT,DELETE ON TABLE vn2008.account_conciliacion TO `financial`; +GRANT SELECT,INSERT,DELETE ON TABLE vn.accountReconciliation TO `financial`; + +-- account_detail +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_detail` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.account_detail TO `financial`; +GRANT SELECT ON TABLE vn2008.account_detail TO `hr`; + +GRANT SELECT ON TABLE vn.accountDetail TO `financial`; +GRANT SELECT ON TABLE vn.accountDetail TO `hr`; + +-- account_detail_type +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`account_detail_type` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.account_detail_type TO `hr`; +GRANT SELECT ON TABLE vn.accountDetailType TO `hr`; + +-- airline +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`airline` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.airline TO `administrative`; +GRANT SELECT,UPDATE ON TABLE vn2008.airline TO `logistic`; + +GRANT SELECT ON TABLE vn.airline TO `administrative`; +GRANT SELECT,UPDATE ON TABLE vn.airline TO `logistic`; + +-- airport +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`airport` AS +SELECT 1; + +GRANT SELECT,INSERT,UPDATE ON TABLE vn2008.airport TO `logistic`; +GRANT SELECT,INSERT,UPDATE ON TABLE vn.airport TO `logistic`; + +-- albaran +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran` AS +SELECT 1; + +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn2008.albaran TO `administrative`; +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn.deliveryNote TO `administrative`; + +-- albaran_gestdoc +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran_gestdoc` AS +SELECT 1; + +GRANT SELECT,INSERT ON TABLE vn2008.albaran_gestdoc TO `administrative`; +GRANT SELECT,INSERT ON TABLE vn.deliveryNoteDms TO `administrative`; + +-- albaran_state +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`albaran_state` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.albaran_state TO `administrative`; +GRANT SELECT ON TABLE vn.deliveryNoteState TO `administrative`; + +-- awb_component +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component` AS +SELECT 1; + +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn2008.awb_component TO `buyer`; +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn2008.awb_component TO `logistic`; +GRANT SELECT ON TABLE vn2008.awb_component TO `administrative`; + +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn.awbComponent TO `buyer`; +GRANT SELECT,INSERT,UPDATE,DELETE ON TABLE vn.awbComponent TO `logistic`; +GRANT SELECT ON TABLE vn.awbComponent TO `administrative`; + +-- awb_component_template +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component_template` AS +SELECT 1; + +GRANT SELECT,INSERT,UPDATE ON TABLE vn2008.awb_component_template TO `logistic`; +GRANT SELECT,INSERT,UPDATE ON TABLE vn.awbComponentTemplate TO `logistic`; + +-- awb_component_type +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_component_type` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.awb_component_type TO `administrative`; +GRANT SELECT,UPDATE ON TABLE vn2008.awb_component_type TO `logistic`; + +GRANT SELECT ON TABLE vn.awbComponentType TO `administrative`; +GRANT SELECT,UPDATE ON TABLE vn.awbComponentType TO `logistic`; + +-- awb_gestdoc +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_gestdoc` AS +SELECT 1; + +GRANT SELECT,INSERT ON TABLE vn2008.awb_gestdoc TO `buyer`; +GRANT SELECT ON TABLE vn2008.awb_gestdoc TO `administrative`; +GRANT INSERT ON TABLE vn2008.awb_gestdoc TO `logistic`; +GRANT SELECT ON TABLE vn2008.awb_gestdoc TO `hr`; + +GRANT SELECT,INSERT ON TABLE vn.awbDms TO `buyer`; +GRANT SELECT ON TABLE vn.awbDms TO `administrative`; +GRANT INSERT ON TABLE vn.awbDms TO `logistic`; +GRANT SELECT ON TABLE vn.awbDms TO `hr`; + +-- awb_recibida +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_recibida` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.awb_recibida TO `administrative`; +GRANT SELECT ON TABLE vn2008.awb_recibida TO `hrBoss`; + +GRANT SELECT ON TABLE vn.awbInvoiceIn TO `administrative`; +GRANT SELECT ON TABLE vn.awbInvoiceIn TO `hrBoss`; + +-- awb_role +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_role` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.awb_role TO `logistic`; +GRANT SELECT ON TABLE vn.awbRole TO `logistic`; + +-- awb_unit +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`awb_unit` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.awb_unit TO `logistic`; +GRANT SELECT ON TABLE vn.awbUnit TO `logistic`; + +-- balance_nest_tree +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`balance_nest_tree` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.balance_nest_tree TO `financialBoss`; +GRANT SELECT ON TABLE vn.balanceNestTree TO `financialBoss`; + +-- buy_edi_k012 +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k012` AS +SELECT 1; + +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `edi`.`ektK2` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.buy_edi_k012 TO `buyer`; +GRANT SELECT ON TABLE vn2008.buy_edi_k012 TO `administrative`; + +GRANT SELECT ON TABLE edi.ektK1 TO `buyer`; +GRANT SELECT ON TABLE edi.ektK1 TO `administrative`; + +GRANT SELECT ON TABLE edi.ektK2 TO `buyer`; +GRANT SELECT ON TABLE edi.ektK2 TO `administrative`; + +-- buy_edi_k03 +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k03` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.buy_edi_k03 TO `buyer`; +GRANT SELECT ON TABLE vn2008.buy_edi_k03 TO `administrative`; + +GRANT SELECT ON TABLE edi.ektK3 TO `buyer`; +GRANT SELECT ON TABLE edi.ektK3 TO `administrative`; + +-- buy_edi_k04 +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`buy_edi_k04` AS +SELECT 1; + +GRANT SELECT ON TABLE vn2008.buy_edi_k04 TO `buyer`; +GRANT SELECT ON TABLE vn2008.buy_edi_k04 TO `administrative`; + +GRANT SELECT ON TABLE edi.ektK4 TO `buyer`; +GRANT SELECT ON TABLE edi.ektK4 TO `administrative`; + +-- definitivo +CREATE OR REPLACE DEFINER=`root`@`localhost` + SQL SECURITY DEFINER + VIEW `vn2008`.`definitivo` AS +SELECT 1; + +GRANT SELECT,INSERT ON TABLE vn2008.definitivo TO `productionAssi`; +GRANT SELECT ON TABLE vn.dmsStorageBox TO `productionAssi`; diff --git a/db/versions/10865-goldenGalax/00-firstScript.sql b/db/versions/10865-goldenGalax/00-firstScript.sql new file mode 100644 index 000000000..889477b5c --- /dev/null +++ b/db/versions/10865-goldenGalax/00-firstScript.sql @@ -0,0 +1,15 @@ +REVOKE UPDATE ON TABLE vn2008.Vehiculos FROM officeBoss; +REVOKE SELECT ON TABLE vn2008.Vehiculos FROM claimManager; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.Vehiculos FROM deliveryAssistant; +REVOKE SELECT ON TABLE vn2008.versiones FROM employee; +REVOKE INSERT ON TABLE vn2008.XDiario FROM financial; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.XDiario FROM buyer; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM administrative; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM hr; +REVOKE SELECT, INSERT, UPDATE, DELETE ON TABLE vn2008.XDiario FROM buyerBoss; +REVOKE SELECT, INSERT ON TABLE vn2008.workerDocument FROM hr; +REVOKE SELECT ON TABLE vn2008.warehouse FROM guest; +REVOKE SELECT ON TABLE vn2008.warehouse FROM employee; +REVOKE SELECT, INSERT, UPDATE ON TABLE vn2008.workerTeam FROM salesAssistant; +REVOKE DELETE ON TABLE vn2008.workerTeam FROM salesBoss; +REVOKE SELECT ON TABLE vn2008.v_compres FROM administrative; \ No newline at end of file diff --git a/db/versions/10869-crimsonDracena/00-firstScript.sql b/db/versions/10869-crimsonDracena/00-firstScript.sql new file mode 100644 index 000000000..0042d24e3 --- /dev/null +++ b/db/versions/10869-crimsonDracena/00-firstScript.sql @@ -0,0 +1 @@ +REVOKE SELECT ON TABLE vn2008.reference_min FROM logistic;