export structure and data from production

This commit is contained in:
Bernat 2018-10-25 09:41:58 +02:00
parent a8aeaab97d
commit 1c81fa55ab
15 changed files with 1719 additions and 659 deletions

View File

@ -1,18 +1,18 @@
::IMPORTANT Any changes in this file are to applyed to mirror file export-data.sh ::IMPORTANT Any changes in this file are to applyed to mirror file export-data.sh
echo USE `account`; > install/dump/03-dumpedFixtures.sql echo USE `account`; > install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql
echo USE `salix`; >> install/dump/03-dumpedFixtures.sql echo USE `salix`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql
echo USE `vn`; >> install/dump/03-dumpedFixtures.sql echo USE `vn`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel>> install/dump/dumpedFixtures.sql
echo USE `vn2008`; >> install/dump/03-dumpedFixtures.sql echo USE `vn2008`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql
echo USE `bi`; >> install/dump/03-dumpedFixtures.sql echo USE `bi`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql
echo USE `cache`; >> install/dump/03-dumpedFixtures.sql echo USE `cache`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql
echo USE `hedera`; >> install/dump/03-dumpedFixtures.sql echo USE `hedera`; >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql

View File

@ -1,16 +1,16 @@
#!/bin/bash #!/bin/bash
#IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd #IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd
echo "USE \`account\`;" > install/dump/03-dumpedFixtures.sql echo "USE \`account\`;" > install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql
echo "USE \`salix\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`salix\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> install/dump/dumpedFixtures.sql
echo "USE \`vn\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`vn\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info vn cplusInvoiceType477 cplusSubjectOp cplusTaxBreak bookingPlanner pgc tag alertLevel >> install/dump/dumpedFixtures.sql
echo "USE \`vn2008\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`vn2008\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info vn2008 accion_dits Gastos Tintas tarifa_componentes tarifa_componentes_series state bionic_updating_options Grupos Monedas container iva_group_codigo escritos cl_est cl_con cl_res cl_dev cl_mot >> install/dump/dumpedFixtures.sql
echo "USE \`bi\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`bi\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info bi tarifa_componentes tarifa_componentes_series >> install/dump/dumpedFixtures.sql
echo "USE \`cache\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`cache\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql
echo "USE \`hedera\`;" >> install/dump/03-dumpedFixtures.sql echo "USE \`hedera\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/03-dumpedFixtures.sql mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql

View File

@ -1,2 +1,2 @@
::IMPORTANT Any changes in this file are to applyed to mirror file export-structure.sh ::IMPORTANT Any changes in this file are to applyed to mirror file export-structure.sh
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
#IMPORTANT Any changes in this file are to applyed to mirror file export-structure.cmd #IMPORTANT Any changes in this file are to applyed to mirror file export-structure.cmd
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/01-structure.sql mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --comments --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera stock > install/dump/structure.sql

View File

@ -3,9 +3,6 @@
* Ya está en producción * Ya está en producción
**/ **/
ALTER TABLE `vn2008`.`Clientes`
ADD COLUMN `bankEntityFk` INT(10) UNSIGNED NULL AFTER `hasLcr`;
USE `vn`; USE `vn`;
CREATE CREATE
OR REPLACE ALGORITHM = UNDEFINED OR REPLACE ALGORITHM = UNDEFINED

View File

@ -1,13 +0,0 @@
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `newInstance` `newInstance` TEXT NULL DEFAULT NULL ;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `model` `changedModel` TEXT CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ,
ADD COLUMN `changedModelId` INT(11) NULL DEFAULT NULL AFTER `newInstance`,
ADD COLUMN `changedModelValue` VARCHAR(45) NULL DEFAULT NULL AFTER `changedModelId`;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `changedModel` `changedModel` VARCHAR(45) CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NULL DEFAULT NULL ;

View File

@ -1,11 +0,0 @@
DROP TRIGGER IF EXISTS `vn`.`clientLog_BEFORE_INSERT`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` TRIGGER `vn`.`clientLog_BEFORE_INSERT` BEFORE INSERT ON `clientLog` FOR EACH ROW
BEGIN
IF NEW.newInstance is NULL THEN
SET NEW.newInstance = NEW.description;
END IF;
END$$
DELIMITER ;

View File

@ -1,10 +0,0 @@
ALTER TABLE `vn`.`clientLog`
DROP FOREIGN KEY `clientLog_ibfk_2`;
ALTER TABLE `vn`.`clientLog`
CHANGE COLUMN `userFk` `userFk` INT(10) UNSIGNED NULL DEFAULT NULL ;
ALTER TABLE `vn`.`clientLog`
ADD CONSTRAINT `clientLog_ibfk_2`
FOREIGN KEY (`userFk`)
REFERENCES `account`.`user` (`id`)
ON DELETE CASCADE
ON UPDATE CASCADE;

View File

@ -1,17 +0,0 @@
INSERT INTO salix.ACL(id, model, property, accessType, permission, principalType, principalId)
VALUES
(104, 'Item', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(105, 'ItemBarcode', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(106, 'ItemBotanical', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(107, 'ItemNiche', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(108, 'ItemPlacement', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss'),
(109, 'UserConfig', '*', '*', 'ALLOW', 'ROLE', 'employee'),
(110, 'Bank', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(111, 'ClientLog', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(112, 'Defaulter', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(113, 'ClientRisk', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(114, 'Receipt', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(115, 'Receipt', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
UPDATE salix.ACL
SET model='ItemTag', property='*', accessType='WRITE', permission='ALLOW', principalType='ROLE', principalId='marketingBoss'
WHERE id=52;

View File

@ -1,8 +0,0 @@
CREATE TABLE `vn`.`userConfig` (
`userFk` int(10) unsigned NOT NULL,
`warehouseFk` smallint(6) DEFAULT NULL,
`companyFk` smallint(5) unsigned DEFAULT NULL,
`created` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`userFk`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Configuración de usuario en Salix';

View File

@ -1,119 +0,0 @@
USE `vn`;
DROP procedure IF EXISTS `itemDiary`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `itemDiary`(IN vItemId INT, IN vWarehouse INT)
BEGIN
DECLARE vDateInventory DATETIME;
DECLARE vCurdate DATE DEFAULT CURDATE();
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
-- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance
SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores;
SET @a = 0;
SELECT sql_no_cache DATE(date) AS date,
alertLevel,
stateName,
origin,
reference,
clientFk,
name,
`in`,
`out`,
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
isPicked,
isTicket
FROM
( SELECT tr.landed as date,
b.quantity as `in`,
NULL as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.landed >= vDateInventory
AND vWarehouse = tr.warehouseInFk
AND b.itemFk = vItemId
AND e.isInventory = 0
UNION ALL
SELECT tr.shipped as date,
NULL as `in`,
b.quantity as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.warehouse w ON w.id = tr.warehouseOutFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.shipped >= vDateInventory
AND vWarehouse =tr.warehouseOutFk
AND s.id <> 4
AND b.itemFk = vItemId
AND e.isInventory = 0
AND w.isFeedStock = 0
UNION ALL
SELECT t.shipped as date,
NULL as `in`,
s.quantity as `out`,
al.alertLevel as alertLevel,
st.name AS stateName,
t.nickname as name,
t.refFk as reference,
t.id as origin,
t.clientFk,
TRUE as isPicked, -- stk.id as isPicked
TRUE as isTicket
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.ticketState ts ON ts.ticket = t.id
JOIN vn.client c ON c.id = t.clientFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN t.shipped < vCurdate THEN 3
WHEN t.shipped > vDayEnd THEN 0
ELSE IFNULL(ts.alertLevel, 0)
END
JOIN vn.state st ON st.code = al.code
-- LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14
WHERE t.shipped >= vDateInventory
AND s.itemFk = vItemId
AND vWarehouse =t.warehouseFk
) AS itemDiary
ORDER BY date DESC, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC;
END$$
DELIMITER ;

View File

@ -1,14 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`defaulter` AS
SELECT
`d`.`client` AS `clientFk`,
`d`.`date` AS `created`,
`d`.`amount` AS `amount`,
`d`.`defaulterSince` AS `defaulterSinced`,
`d`.`hasChanged` AS `hasChanged`
FROM
`bi`.`defaulters` `d`;

View File

@ -1,12 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `clientRisk` AS
SELECT
`c`.`customer_id` AS `clientFk`,
`c`.`company_id` AS `companyFk`,
`c`.`amount` AS `amount`
FROM
`bi`.`customer_risk` `c`;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff