update fixtures / script for automatic change update in the BD

This commit is contained in:
SAMBA\bernat 2018-02-16 13:01:04 +01:00
parent 63718d4d86
commit 2390ee3b01
11 changed files with 74461 additions and 74999 deletions

View File

@ -10,7 +10,6 @@ BEGIN
SELECT `TABLE_SCHEMA`, `TABLE_NAME`
FROM `information_schema`.`TABLES`
WHERE `TABLE_TYPE` = 'BASE TABLE'
AND `TABLE_ROWS` > 0
AND `TABLE_SCHEMA` NOT IN ('information_schema', 'mysql', 'performance_schema');
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
USE `account`;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: db.verdnatura.es Database: account
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `role`
--
LOCK TABLES `role` WRITE;
/*!40000 ALTER TABLE `role` DISABLE KEYS */;
INSERT INTO `role` VALUES (0,'root','Rol con todos los privilegios',0,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(1,'employee','Empleado básico',1,'2017-05-19 07:04:58','2017-11-29 10:06:31'),(2,'customer','Privilegios básicos de un cliente',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(3,'agency','Consultar tablas de predicciones de bultos',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(5,'administrative','Tareas relacionadas con la contabilidad',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(6,'guest','Privilegios para usuarios sin cuenta',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(9,'developer','Desarrolladores del sistema',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(11,'account','Privilegios relacionados con el login',0,'2017-05-19 07:04:58','2017-09-20 17:06:35'),(13,'teamBoss','Jefe de departamento',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(14,'manageEmployee','Privilegios para gestión de empleados',0,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(15,'logistic','Departamento de compras, responsables de la logistica',1,'2017-05-19 07:04:58','2018-02-12 10:50:10'),(16,'logisticBoss','Jefe del departamento de logística',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(17,'adminBoss','Jefe del departamento de administración',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(18,'salesPerson','Departamento de ventas',1,'2017-05-19 07:04:58','2017-05-19 07:04:58'),(19,'salesBoss','Jefe del departamento de ventas',1,'2017-05-19 07:04:58','2017-08-16 12:38:27'),(20,'manager','Departamento de gerencia',1,'2017-06-01 14:57:02','2017-06-01 14:57:51'),(21,'salesAssistant','Jefe auxiliar de ventas',1,'2017-08-16 12:40:52','2017-08-16 12:40:52'),(22,'teamManager','Jefe de departamento con privilegios de auxiliar de venta.',1,'2017-09-07 09:08:12','2017-09-07 09:08:12'),(30,'financialBoss','Director finaciero',1,'2017-09-21 11:05:36','2017-09-21 11:05:36'),(31,'freelancer','Trabajadores por cuenta ajena',1,'2017-10-10 12:57:26','2017-10-10 12:59:27'),(32,'ett','Trabajadores de empresa temporal',1,'2017-10-10 12:58:58','2017-10-10 12:59:20'),(33,'invoicing','Personal con acceso a facturación',0,'2018-01-29 16:43:34','2018-01-29 16:43:34'),(34,'agencyAdmin','Gestión administrativa de agencias',1,'2018-01-29 16:44:39','2018-01-29 16:44:39'),(35,'buyer','Departamento de compras',1,'2018-02-12 10:35:42','2018-02-12 10:35:42');
/*!40000 ALTER TABLE `role` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `roleRole`
--
LOCK TABLES `roleRole` WRITE;
/*!40000 ALTER TABLE `roleRole` DISABLE KEYS */;
INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,14),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,14),(5,18),(5,19),(5,21),(5,33),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,14),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(13,14),(14,14),(15,1),(15,2),(15,3),(15,6),(15,11),(15,15),(15,35),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,14),(16,15),(16,16),(16,35),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,14),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,14),(19,18),(19,19),(19,21),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,14),(20,20),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,14),(21,18),(21,21),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,14),(22,18),(22,21),(22,22),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,14),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35);
/*!40000 ALTER TABLE `roleRole` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `roleInherit`
--
LOCK TABLES `roleInherit` WRITE;
/*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */;
INSERT INTO `roleInherit` VALUES (9,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(1,2),(5,2),(1,3),(17,5),(30,5),(11,6),(1,11),(2,11),(3,11),(16,13),(17,13),(19,13),(20,13),(21,13),(22,13),(5,14),(13,14),(16,15),(21,18),(5,19),(17,20),(30,20),(19,21),(22,21),(30,22),(5,33),(34,33),(15,35);
/*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-02-12 13:49:52
USE `salix`;
-- MySQL dump 10.13 Distrib 5.7.17, for Win64 (x86_64)
--
-- Host: db.verdnatura.es Database: salix
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `ACL`
--
LOCK TABLES `ACL` WRITE;
/*!40000 ALTER TABLE `ACL` DISABLE KEYS */;
INSERT INTO `ACL` VALUES (1,'Account','*','*','ALLOW','ROLE','employee'),(3,'Address','*','*','ALLOW','ROLE','employee'),(5,'AgencyService','*','READ','ALLOW','ROLE','employee'),(7,'Client','*','*','ALLOW','ROLE','employee'),(9,'ClientObservation','*','*','ALLOW','ROLE','employee'),(11,'ContactChannel','*','READ','ALLOW','ROLE','employee'),(13,'Employee','*','READ','ALLOW','ROLE','employee'),(14,'PayMethod','*','READ','ALLOW','ROLE','employee'),(16,'FakeProduction','*','READ','ALLOW','ROLE','employee'),(17,'Warehouse','* ','READ','ALLOW','ROLE','employee'),(18,'State','*','READ','ALLOW','ROLE','employee'),(20,'TicketState','*','*','ALLOW','ROLE','employee'),(24,'Delivery','*','READ','ALLOW','ROLE','employee'),(25,'Zone','*','READ','ALLOW','ROLE','employee'),(26,'ClientCredit','*','*','ALLOW','ROLE','employee'),(27,'ClientCreditLimit','*','READ','ALLOW','ROLE','employee'),(28,'ClientObservation','*','READ','ALLOW','ROLE','employee'),(30,'GreugeType','*','READ','ALLOW','ROLE','employee'),(31,'Mandate','*','READ','ALLOW','ROLE','employee'),(32,'MandateType','*','READ','ALLOW','ROLE','employee'),(33,'Company','*','READ','ALLOW','ROLE','employee'),(34,'Greuge','*','READ','ALLOW','ROLE','employee'),(35,'AddressObservation','*','*','ALLOW','ROLE','employee');
/*!40000 ALTER TABLE `ACL` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2018-02-12 13:49:52

View File

View File

@ -1,262 +1,5 @@
INSERT INTO `account`.`role`(`id`, `name`, `description`)
VALUES
(1, 'employee', 'Privilegios básicos de un empleado'),
(2, 'customer', 'Privilegios básicos de un cliente'),
(3, 'agency', 'Consultar tablas de predicciones de bultos'),
(5, 'administrative', 'Tareas relacionadas con la contabilidad'),
(6, 'guest', 'Privilegios para usuarios sin cuenta'),
(9, 'developer', 'Desarrolladores del sistema'),
(11, 'account', 'Privilegios relacionados con el login'),
(13, 'teamBoss', 'Jefe de departamento'),
(14, 'manageEmployee', 'Privilegios para gestión de empleados'),
(15, 'logistic', 'Departamento de logística'),
(16, 'logisticBoss', 'Jefe del departamento de logística'),
(17, 'adminBoss', 'Jefe del departamento de administración'),
(18, 'salesPerson', 'Departamento de ventas'),
(19, 'salesBoss', 'Jefe del departamento de ventas'),
(20, 'manager', 'Departamento de gerencia'),
(21, 'salesAssistant', 'Jefe auxiliar de ventas'),
(22, 'teamManager', 'Jefe de departamento con privilegios de auxiliar de venta.'),
(30, 'financialBoss', 'Director finaciero'),
(31, 'freelancer', 'Trabajadores por cuenta ajena'),
(32, 'ett', 'Trabajadores de empresa temporal'),
(33, 'root', 'Rol con todos los privilegios');
UPDATE `account`.`role` SET `id` = 0 WHERE `id` = 33;
INSERT INTO `account`.`roleRole`(`role`, `inheritsFrom`)
VALUES
(0, 0),
(0, 1),
(0, 2),
(0, 3),
(0, 5),
(0, 6),
(0, 9),
(0, 11),
(0, 13),
(0, 14),
(0, 15),
(0, 16),
(0, 17),
(0, 18),
(0, 19),
(0, 20),
(0, 21),
(0, 22),
(0, 30),
(0, 31),
(0, 32),
(1, 1),
(1, 2),
(1, 3),
(1, 6),
(1, 11),
(2, 2),
(2, 6),
(2, 11),
(3, 3),
(3, 6),
(3, 11),
(5, 1),
(5, 2),
(5, 3),
(5, 5),
(5, 6),
(5, 11),
(5, 13),
(5, 14),
(5, 18),
(5, 19),
(5, 21),
(6, 6),
(9, 0),
(9, 1),
(9, 2),
(9, 3),
(9, 5),
(9, 6),
(9, 9),
(9, 11),
(9, 13),
(9, 14),
(9, 15),
(9, 16),
(9, 17),
(9, 18),
(9, 19),
(9, 20),
(9, 21),
(9, 22),
(9, 30),
(9, 31),
(9, 32),
(11, 6),
(11, 11),
(13, 1),
(13, 2),
(13, 3),
(13, 6),
(13, 11),
(13, 13),
(13, 14),
(14, 14),
(15, 1),
(15, 2),
(15, 3),
(15, 6),
(15, 11),
(15, 15),
(16, 1),
(16, 2),
(16, 3),
(16, 6),
(16, 11),
(16, 13),
(16, 14),
(16, 15),
(16, 16),
(17, 1),
(17, 2),
(17, 3),
(17, 5),
(17, 6),
(17, 11),
(17, 13),
(17, 14),
(17, 17),
(17, 18),
(17, 19),
(17, 20),
(17, 21),
(18, 1),
(18, 2),
(18, 3),
(18, 6),
(18, 11),
(18, 18),
(19, 1),
(19, 2),
(19, 3),
(19, 6),
(19, 11),
(19, 13),
(19, 14),
(19, 18),
(19, 19),
(19, 21),
(20, 1),
(20, 2),
(20, 3),
(20, 6),
(20, 11),
(20, 13),
(20, 14),
(20, 20),
(21, 1),
(21, 2),
(21, 3),
(21, 6),
(21, 11),
(21, 18),
(21, 21),
(22, 1),
(22, 2),
(22, 3),
(22, 6),
(22, 11),
(22, 13),
(22, 14),
(22, 18),
(22, 21),
(22, 22),
(30, 1),
(30, 2),
(30, 3),
(30, 5),
(30, 6),
(30, 11),
(30, 13),
(30, 14),
(30, 18),
(30, 19),
(30, 20),
(30, 21),
(30, 22),
(30, 30),
(31, 1),
(31, 2),
(31, 3),
(31, 6),
(31, 11),
(31, 31),
(32, 1),
(32, 2),
(32, 3),
(32, 6),
(32, 11),
(32, 32);
INSERT INTO `account`.`roleInherit`(`role`, `inheritsFrom`)
VALUES
(9, 0),
(5, 1),
(13, 1),
(15, 1),
(18, 1),
(31, 1),
(32, 1),
(1, 2),
(5, 2),
(1, 3),
(17, 5),
(30, 5),
(11, 6),
(1, 11),
(2, 11),
(3, 11),
(16, 13),
(17, 13),
(19, 13),
(20, 13),
(22, 13),
(5, 14),
(13, 14),
(16, 15),
(21, 18),
(5, 19),
(17, 20),
(30, 20),
(19, 21),
(22, 21),
(30, 22);
INSERT INTO `salix`.`ACL`(`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
(1, 'Account', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(2, 'Account', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(3, 'Address', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(4, 'Address', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(5, 'AgencyService', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(6, 'AgencyService', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(7, 'Client', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(8, 'Client', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(9, 'ClientObservation', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(10, 'ClientObservation', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(11, 'ContactChannel', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(12, 'ContactChannel', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(13, 'Employee', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(14, 'PayMethod', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(15, 'PayMethod', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(16, 'FakeProduction', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(17, 'Warehouse', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(18, 'State', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(19, 'FakeProduction', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(20, 'TicketState', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
(22, 'TicketState', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(23, 'TicketState', '*', 'EXECUTE', 'ALLOW', 'ROLE', 'employee'),
(24, 'Delivery', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
(25, 'Zone', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `util`.`config` ( `dbVersion`, `hasTriggersDisabled`, `environment`)
VALUES ('1.0.0', '0', 'development');
INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`)
VALUES
@ -272,6 +15,10 @@ INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`)
(10, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 9, 1, 'JessicaJones@verdnatura.es'),
(11, 'Cyborg', 'ac754a330530832ba1bf7687f577da91', 1, 1, 'cyborg@verdnatura.es');
INSERT INTO `account`.`user`(`name`,`password`,`role`,`active`,`email`)
SELECT name,'ac754a330530832ba1bf7687f577da91',id,1,CONCAT(name,'@verdnatura.es')
FROM `account`.`role`;
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`)
VALUES
(1, 'España', 0, 'ES', 1),
@ -390,34 +137,34 @@ INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `isDefaultAddress`, `clientFk`, `agencyFk`, `longitude`, `latitude`, `isEqualizated`)
VALUES
(101, 'Bruce Banner', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(102, 'Bruce Banner', 'Somewhere in New York', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(103, 'Bruce Banner', 'Somewhere in Japan', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(104, 'Bruce Banner', 'Somewhere in Spain', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(105, 'Bruce Banner', 'Somewhere in Potugal', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(106, 'Bruce Banner', 'Somewhere in UK', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(107, 'Bruce Banner', 'Somewhere in Valencia', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(108, 'Bruce Banner', 'Somewhere in Silla', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(109, 'Bruce Banner', 'Somewhere in London', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(110, 'Bruce Banner', 'Somewhere in Algemesi', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(111, 'Bruce Banner', 'Somewhere in Carlet', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(112, 'Bruce Banner', 'Somewhere in Campanar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(113, 'Bruce Banner', 'Somewhere in Malilla', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(114, 'Bruce Banner', 'Somewhere in France', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(115, 'Bruce Banner', 'Somewhere in Birmingham', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(116, 'Bruce Banner', 'Somewhere in Scotland', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(117, 'Bruce Banner', 'Somewhere in nowhere', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(118, 'Bruce Banner', 'Somewhere over the rainbow', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(119, 'Bruce Banner', 'Somewhere in Alberic', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(120, 'Bruce Banner', 'Somewhere in Montortal', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(121, 'Petter Parker', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0),
(122, 'Clark Kenn', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0),
(123, 'Tony Stark', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0),
(124, 'Max Eisenhardt', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0),
(125, 'David Charles Haller', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0),
(126, 'Hank Pym', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0),
(127, 'Charles Xavier', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0),
(128, 'Jessica Jones', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0);
(101, '01', 'Somewhere in Thailand', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(102, '02', 'Somewhere in Poland', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(103, '03', 'Somewhere in Japan', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(104, '04', 'Somewhere in Spain', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(105, '05', 'Somewhere in Potugal', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(106, '06', 'Somewhere in UK', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(107, '07', 'Somewhere in Valencia', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(108, '08', 'Somewhere in Silla', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(109, '09', 'Somewhere in London', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(110, '10', 'Somewhere in Algemesi', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(111, '11', 'Somewhere in Carlet', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(112, '12', 'Somewhere in Campanar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(113, '13', 'Somewhere in Malilla', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(114, '14', 'Somewhere in France', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(115, '15', 'Somewhere in Birmingham', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(116, '16', 'Somewhere in Scotland', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(117, '17', 'Somewhere in nowhere', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(118, '18', 'Somewhere over the rainbow', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(119, '19', 'Somewhere in Alberic', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(120, '20', 'Somewhere in Montortal', 'Silla', 46460, 1, NULL, NULL, 1, 1, 9, 2, NULL, NULL, 0),
(121, 'my other address', 'NY roofs', 'Silla', 46460, 1, NULL, NULL, 1, 1, 2, 2, NULL, NULL, 0),
(122, 'my other address', 'The phone box', 'Silla', 46460, 1, NULL, NULL, 1, 1, 3, 2, NULL, NULL, 0),
(123, 'my other address', 'Stark tower', 'Silla', 46460, 1, NULL, NULL, 1, 1, 4, 2, NULL, NULL, 0),
(124, 'my other address', 'The plastic cell', 'Silla', 46460, 1, NULL, NULL, 1, 1, 5, 2, NULL, NULL, 0),
(125, 'my other address', 'Many places', 'Silla', 46460, 1, NULL, NULL, 1, 1, 6, 2, NULL, NULL, 0),
(126, 'my other address', 'Your pocket', 'Silla', 46460, 1, NULL, NULL, 1, 1, 7, 2, NULL, NULL, 0),
(127, 'my other address', 'Cerebro', 'Silla', 46460, 1, NULL, NULL, 1, 1, 8, 2, NULL, NULL, 0),
(128, 'my other address', 'Luke Cages Bar', 'Silla', 46460, 1, NULL, NULL, 1, 1, 10, 2, NULL, NULL, 0);
INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
VALUES
@ -575,14 +322,14 @@ INSERT INTO `vn`.`mandate`(`id`, `clientFk`, `companyFk`, `code`, `created`, `ma
INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`)
VALUES
(1, 'Gear', 1, 'B92A26'),
(2, 'Items', 2, 'dcf711');
(1, 'Plant', 1, 'B92A26'),
(2, 'Flower', 2, 'dcf711');
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `life`,`workerFk`)
VALUES
(1, 'ARM', 'Armor', 1, 15, 5),
(2, 'ITG', 'Infinity gem', 2, 30, 5),
(3, 'WPN', 'Weapon', 2, 30, 5);
(1, 'CRI', 'Crisantemo', 2, 15, 5),
(2, 'ITG', 'Anthurium', 1, 30, 5),
(3, 'WPN', 'Paniculata', 2, 30, 5);
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`)
VALUES
@ -618,8 +365,8 @@ INSERT INTO `vn`.`taxClass`(`id`, `description`, `code`)
INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`)
VALUES
(1, 'Automatic armor', 1, 1),
(2, 'Magic weapon' , 2, 2);
(05080000, 'Coral y materiales similares' , 2, 2),
(06021010, 'Plantas vivas: Esqueje/injerto, Vid', 1, 1);
INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`)
VALUES
@ -628,11 +375,11 @@ INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`)
INSERT INTO `vn`.`item`(`id`, `name`,`typeFk`,`size`,`inkFk`,`category`,`stems`,`originFk`,`description`,`producerFk`,`intrastatFk`,`isOnOffer`,`expenceFk`,`isBargain`,`comment`,`relevancy`,`image`,`taxClassFk`)
VALUES
(1, 'Gem of Time', 2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems', 1, 2, 0, 1, 0, NULL, 0, 66540, 1),
(2, 'Gem of Mind', 2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems', 1, 2, 0, 1, 0, NULL, 0, 65540, 1),
(3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor', 1, 1, 0, 1, 0, NULL, 0, 61692, 1),
(4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor', 1, 1, 1, 2, 0, NULL, 0, 66090, 2),
(5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!', 2, 2, 1, 2, 0, NULL, 0, 67350, 2);
(1, 'Gem of Time', 2, 70, 'AMA', 'EXT', 1, 1, 'One of the infinity gems', 1, 06021010, 0, 1, 0, NULL, 0, 66540, 1),
(2, 'Gem of Mind', 2, 70, 'AZL', 'EXT', 1, 2, 'One of the infinity gems', 1, 06021010, 0, 1, 0, NULL, 0, 65540, 1),
(3, 'Iron Patriot', 1, 60, 'AMR', 'EXT', 1, 3, 'Rhodeys armor', 1, 05080000, 0, 1, 0, NULL, 0, 61692, 1),
(4, 'Mark I', 1, 60, 'AMR', 'EXT', 1, 1, 'Iron Mans first armor', 1, 05080000, 1, 2, 0, NULL, 0, 66090, 2),
(5, 'Mjolnir', 3, 30, 'AZR', 'EXT', 1, 2, 'Thors hammer!', 2, 06021010, 1, 2, 0, NULL, 0, 67350, 2);
INSERT INTO `salix`.`user`(`id`,`username`,`password`,`email`)
VALUES
@ -656,24 +403,4 @@ INSERT INTO `vn`.`itemTag`(`id`,`itemFk`,`tagFk`,`value`,`priority`)
INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`)
VALUES
(1, 1, 1, 'insert', 'insert change was made!'),
(2, 1, 1, 'delete', 'delete change was made!'),
(3, 1, 1, 'update', 'update change was made!'),
(4, 1, 1, 'insert', 'insert change was made!'),
(5, 1, 1, 'delete', 'delete change was made!'),
(6, 1, 1, 'update', 'update change was made!'),
(7, 1, 1, 'insert', 'insert change was made!'),
(8, 1, 1, 'delete', 'delete change was made!'),
(9, 1, 1, 'update', 'update change was made!'),
(10, 1, 1, 'insert', 'insert change was made!'),
(11, 1, 1, 'delete', 'delete change was made!'),
(12, 1, 1, 'insert', 'insert change was made!'),
(13, 1, 1, 'delete', 'delete change was made!'),
(14, 1, 1, 'update', 'update change was made!'),
(15, 1, 1, 'insert', 'insert change was made!'),
(16, 1, 1, 'delete', 'delete change was made!'),
(17, 1, 1, 'update', 'update change was made!'),
(18, 1, 1, 'insert', 'insert change was made!'),
(19, 1, 1, 'delete', 'delete change was made!'),
(20, 1, 1, 'delete', 'delete change was made!'),
(21, 1, 1, 'update', 'update change was made!');
('1', '1', '1', 'insert', 'We made an change!');

View File

@ -5,7 +5,7 @@ ENV TZ GMT-1
WORKDIR /docker-entrypoint-initdb.d
COPY *.sql ./
COPY 02-changes.sh .
COPY 03-changes.sh .
COPY changes changes
RUN chmod -R 755 .

View File

@ -0,0 +1,7 @@
CREATE TABLE `util`.`config` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`dbVersion` CHAR(11) NULL DEFAULT NULL COMMENT 'The current database version',
`hasTriggersDisabled` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'Defines if triggers are disabled',
`environment` VARCHAR(45) NULL DEFAULT NULL COMMENT 'The current Database environment',
PRIMARY KEY (`id`))
COMMENT = 'Global configuration table';

View File

@ -1,2 +1,7 @@
mysqldump --defaults-extra-file=connect.ini --default-character-set=utf8 --no-data --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera > 01-structure.sql
mysqldump --defaults-file=connect.ini --default-character-set=utf8 --no-data --triggers --routines --events --databases account util vn2008 vn edi bs bi pbx cache salix vncontrol hedera > 01-structure.sql
echo USE `account`; > 02-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> 02-dumpedFixtures.sql
echo USE `salix`; >> 02-dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info salix ACL >> 02-dumpedFixtures.sql

View File

@ -0,0 +1,65 @@
const mysql = require('mysql2/promise');
const fs = require('fs-extra');
(async () => {
try {
const connection = await mysql.createConnection({
host: 'localhost',
user: 'root',
multipleStatements: true
});
let changesDir = './changes';
let results = await connection.query("SELECT dbVersion FROM util.config");
if (results[0].length != 1)
throw new Error('There must be exactly one row in the configuration table');
let version = results[0][0].dbVersion;
if (!version)
throw new Error('Database version not defined');
let dirs = await fs.readdir(changesDir);
dirs.sort(compareVersions);
let lastVersion;
for (let dir of dirs) {
if (compareVersions(dir, version) <= 0) continue;
let path = `${changesDir}/${dir}`;
let files = await fs.readdir(path);
files.sort();
console.log(dir);
for (let file of files) {
let sql = await fs.readFile(`${path}/${file}`, 'utf8');
if (/^\s*$/.test(sql)) continue;
await connection.query(sql);
console.log(` - ${file}`);
}
lastVersion = dir;
}
if (lastVersion) {
await connection.query("UPDATE util.config SET dbVersion = ?", [lastVersion]);
console.log(`Database upgraded successfully to version ${lastVersion}`);
} else {
console.log("Database is alredy in the last version");
}
await connection.end();
process.exit();
} catch (err) {
console.error(err);
process.exit(1);
}
})();
function compareVersions(ver1, ver2) {
let diff;
ver1 = ver1.split('.');
ver2 = ver2.split('.');
diff = parseInt(ver1[0]) - parseInt(ver2[0]);
if (diff !== 0) return diff;
diff = parseInt(ver1[1]) - parseInt(ver2[1]);
if (diff !== 0) return diff;
diff = parseInt(ver1[2]) - parseInt(ver2[2]);
if (diff !== 0) return diff;
return 0;
}

View File

@ -0,0 +1,19 @@
const mysql = require('mysql2/promise');
const fs = require('fs-extra');
(async () => {
try {
const connection = await mysql.createConnection({
host: 'localhost',
user: 'root',
multipleStatements: true
});
sql = await fs.readFile(`04-fixtures.sql`, 'utf8');
await connection.query(sql);
await connection.end();
process.exit();
} catch (err) {
console.error(err);
process.exit(1);
}
})();

View File

@ -38,7 +38,7 @@ module.exports = function(Client) {
},
skip: (params.page - 1) * params.size,
limit: params.size,
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname DESC'],
order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname ASC'],
include: {observations: 'observationType'}
};