Actualize la base de datos

Plus un script que ejecuta la migracion automaticamente
This commit is contained in:
Daniel Cortés
2019-06-18 00:42:19 -04:00
parent 56cbb1fdeb
commit 507a0bef91
4 changed files with 169 additions and 375 deletions

7
.idea/sqldialects.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/create.sql" dialect="MariaDB" />
<file url="file://$PROJECT_DIR$/data.sql" dialect="MariaDB" />
</component>
</project>

View File

@@ -1,7 +1,10 @@
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
#-----------------------------Eliminar todas las tablas--------------------------# #-----------------------------Eliminar todas las tablas--------------------------#
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
start transaction;
set foreign_key_checks = 0; set foreign_key_checks = 0;
set autocommit = 0;
drop table if exists editorial; drop table if exists editorial;
drop table if exists estado; drop table if exists estado;
@@ -17,7 +20,7 @@ drop table if exists correo;
drop table if exists direccion; drop table if exists direccion;
drop table if exists telefono; drop table if exists telefono;
drop table if exists empresa; drop table if exists empresa;
drop table if exists cliente; drop table if exists distribuidor;
drop table if exists cliente; drop table if exists cliente;
drop table if exists trabajador; drop table if exists trabajador;
drop table if exists distribuidor_direccion; drop table if exists distribuidor_direccion;
@@ -34,12 +37,11 @@ drop table if exists boleta;
drop table if exists compra; drop table if exists compra;
drop table if exists venta; drop table if exists venta;
drop table if exists arriendo; drop table if exists arriendo;
drop table if exists libro_compra; drop table if exists ejemplar_compra;
drop table if exists libro_venta; drop table if exists ejemplar_venta;
drop table if exists libro_arriendo; drop table if exists ejemplar_arriendo;
drop table if exists usuario; drop table if exists usuario;
set foreign_key_checks = 1;
#--------------------------------------------------------------------------------# #--------------------------------------------------------------------------------#
#--------------Definicion de las tablas relacionadas a los libros----------------# #--------------Definicion de las tablas relacionadas a los libros----------------#
@@ -163,7 +165,7 @@ create table empresa
inserted_at timestamp default CURRENT_TIMESTAMP inserted_at timestamp default CURRENT_TIMESTAMP
); );
create table cliente create table distribuidor
( (
id int unsigned primary key auto_increment, id int unsigned primary key auto_increment,
empresa_id int unsigned not null, empresa_id int unsigned not null,
@@ -328,27 +330,27 @@ create table arriendo
foreign key (cliente_id) references cliente (id) on delete restrict on update cascade foreign key (cliente_id) references cliente (id) on delete restrict on update cascade
); );
create table libro_compra create table ejemplar_compra
( (
libro_id int unsigned, ejemplar_id int unsigned,
compra_id int unsigned, compra_id int unsigned,
foreign key (libro_id) references libro (id) on delete restrict on update cascade, foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
foreign key (compra_id) references compra (id) on delete restrict on update cascade foreign key (compra_id) references compra (id) on delete restrict on update cascade
); );
create table libro_venta create table ejemplar_venta
( (
libro_id int unsigned, ejemplar_id int unsigned,
venta_id int unsigned, venta_id int unsigned,
foreign key (libro_id) references libro (id) on delete restrict on update cascade, foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
foreign key (venta_id) references venta (id) on delete restrict on update cascade foreign key (venta_id) references venta (id) on delete restrict on update cascade
); );
create table libro_arriendo create table ejemplar_arriendo
( (
libro_id int unsigned, ejemplar_id int unsigned,
arriendo_id int unsigned, arriendo_id int unsigned,
foreign key (libro_id) references libro (id) on delete restrict on update cascade, foreign key (ejemplar_id) references ejemplar (id) on delete restrict on update cascade,
foreign key (arriendo_id) references arriendo (id) on delete restrict on update cascade foreign key (arriendo_id) references arriendo (id) on delete restrict on update cascade
); );
@@ -363,6 +365,11 @@ create table usuario
password binary(32) not null, password binary(32) not null,
salt binary(16) not null, salt binary(16) not null,
trabajador_id int unsigned not null, trabajador_id int unsigned not null,
foreign key (trabajador_id) references trabajador (id) on delete cascade on update cascade, inserted_at timestamp default current_timestamp,
inserted_at timestamp default current_timestamp foreign key (trabajador_id) references trabajador (id) on delete cascade on update cascade
); );
set autocommit = 1;
set foreign_key_checks = 1;
commit;

475
data.sql
View File

@@ -1,356 +1,119 @@
-- MySQL dump 10.17 Distrib 10.3.15-MariaDB, for Linux (x86_64) start transaction;
--
-- Host: localhost Database: biblioteca set foreign_key_checks = 0;
-- ------------------------------------------------------ set autocommit = 0;
-- Server version 10.3.15-MariaDB
INSERT INTO `autor`
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; VALUES (1, 'Howard Philips', 'Lovecraft', NULL, '2019-06-12 16:18:57'),
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; (2, 'Stephen', 'King', NULL, '2019-06-12 16:18:57'),
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; (3, 'Brandon', 'Sanderson', NULL, '2019-06-12 16:18:57');
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; INSERT INTO `categoria`
/*!40103 SET TIME_ZONE='+00:00' */; VALUES (1, 'Terror', '2019-06-12 16:18:57'),
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; (2, 'Aventura', '2019-06-12 16:18:57'),
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; (3, 'Fantasia', '2019-06-12 16:18:57');
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; --
-- INSERT INTO `cliente`
-- Dumping data for table `arriendo` VALUES (1, '21786653-7', 'Cliente', '1', '1', '2019-06-17', '2019-06-13 16:01:33'),
-- (2, '17181388-3', 'Cliente', '2', '2', '2019-06-13', '2019-06-13 16:04:02');
LOCK TABLES `arriendo` WRITE; INSERT INTO `correo`
/*!40000 ALTER TABLE `arriendo` DISABLE KEYS */; VALUES (1, 'HOOLA', '2019-06-13 17:25:41'),
/*!40000 ALTER TABLE `arriendo` ENABLE KEYS */; (2, 'skrd159@gmail.com', '2019-06-13 17:32:13');
UNLOCK TABLES;
INSERT INTO `distribuidor`
-- VALUES (2, 1, '14166920-6', '2019-06-13 03:08:17'),
-- Dumping data for table `autor` (3, 2, '8425080-5', '2019-06-13 03:08:23'),
-- (4, 1, '21629388-6', '2019-06-13 03:08:25'),
(5, 1, '13510176-1', '2019-06-13 03:08:27');
LOCK TABLES `autor` WRITE;
/*!40000 ALTER TABLE `autor` DISABLE KEYS */; INSERT INTO `editorial`
INSERT INTO `autor` VALUES (1,'Howard Philips','Lovecraft',NULL,'2019-06-12 16:18:57'),(2,'Stephen','King',NULL,'2019-06-12 16:18:57'),(3,'Brandon','Sanderson',NULL,'2019-06-12 16:18:57'); VALUES (1, 'Editorial N1', '2019-06-12 16:18:57'),
/*!40000 ALTER TABLE `autor` ENABLE KEYS */; (2, 'Editorial N2', '2019-06-12 16:18:57'),
UNLOCK TABLES; (3, 'Editorial N3', '2019-06-12 16:18:57');
-- INSERT INTO `empresa`
-- Dumping data for table `boleta` VALUES (1, 'Empresa 1', '2019-06-13 00:39:50'),
-- (2, 'Empresa 2', '2019-06-13 00:39:52');
LOCK TABLES `boleta` WRITE; INSERT INTO `estado`
/*!40000 ALTER TABLE `boleta` DISABLE KEYS */; VALUES (1, 'Vendido', '2019-06-12 16:18:57'),
/*!40000 ALTER TABLE `boleta` ENABLE KEYS */; (2, 'Arrendado', '2019-06-12 16:18:57'),
UNLOCK TABLES; (3, 'Disponible', '2019-06-12 16:18:57');
-- INSERT INTO `idioma`
-- Dumping data for table `categoria` VALUES (1, 'Español', '2019-06-12 16:18:57'),
-- (2, 'Ingles', '2019-06-12 16:18:57'),
(3, 'Portuges', '2019-06-12 16:18:57'),
LOCK TABLES `categoria` WRITE; (4, 'Aleman', '2019-06-12 16:18:57'),
/*!40000 ALTER TABLE `categoria` DISABLE KEYS */; (5, 'Ruso', '2019-06-12 16:18:57'),
INSERT INTO `categoria` VALUES (1,'Terror','2019-06-12 16:18:57'),(2,'Aventura','2019-06-12 16:18:57'),(3,'Fantasia','2019-06-12 16:18:57'); (6, 'Japones', '2019-06-12 16:18:57');
/*!40000 ALTER TABLE `categoria` ENABLE KEYS */;
UNLOCK TABLES; INSERT INTO `libro`
VALUES (1, 1, '0-765-31178-X', 2006, 541, 'Mistborn: The Final Empire', 10000,
-- '2019-06-12 16:18:57'),
-- Dumping data for table `cliente` (2, 1, '0-765-31688-9', 2007, 590, 'Mistborn: The Well of Ascension', 10000,
-- '2019-06-12 16:18:57'),
(3, 1, '978-0-7653-1689-9', 2008, 572, 'Mistborn: The Hero of Ages', 10000,
LOCK TABLES `cliente` WRITE; '2019-06-12 16:18:57'),
/*!40000 ALTER TABLE `cliente` DISABLE KEYS */; (4, 2, '1231231231232', 1931, 100, 'The Shadow over Innsmouth', 10000,
INSERT INTO `cliente` VALUES (1,'21786653-7','Cliente','1','1','2019-06-17','2019-06-13 16:01:33'),(2,'17181388-3','Cliente','2','2','2019-06-13','2019-06-13 16:04:02'); '2019-06-12 16:18:57'),
/*!40000 ALTER TABLE `cliente` ENABLE KEYS */; (5, 2, '1231231231232', 1933, 100, 'The Dreams in the Witch House', 10000,
UNLOCK TABLES; '2019-06-12 16:18:57'),
(6, 2, '1231231231232', 1936, 100, 'At the Mountains of Madness', 10000,
-- '2019-06-12 16:18:57'),
-- Dumping data for table `cliente_correo` (7, 3, '0385086954', 1974, 199, 'Carrie', 10000, '2019-06-12 16:18:57'),
-- (8, 3, '978-0-670-26077-5', 1979, 428, 'The Dead Zone', 10000, '2019-06-12 16:18:57'),
(9, 3, '0-670-81302-8', 1986, 1138, 'It', 10000, '2019-06-12 16:18:57');
LOCK TABLES `cliente_correo` WRITE;
/*!40000 ALTER TABLE `cliente_correo` DISABLE KEYS */; INSERT INTO `libro_autor`
/*!40000 ALTER TABLE `cliente_correo` ENABLE KEYS */; VALUES (1, 3),
UNLOCK TABLES; (2, 3),
(3, 3),
-- (4, 1),
-- Dumping data for table `cliente_direccion` (5, 1),
-- (6, 1),
(7, 2),
LOCK TABLES `cliente_direccion` WRITE; (8, 2),
/*!40000 ALTER TABLE `cliente_direccion` DISABLE KEYS */; (9, 2);
/*!40000 ALTER TABLE `cliente_direccion` ENABLE KEYS */;
UNLOCK TABLES; INSERT INTO `libro_categoria`
VALUES (1, 3),
-- (2, 3),
-- Dumping data for table `cliente_telefono` (3, 3),
-- (4, 1),
(5, 1),
LOCK TABLES `cliente_telefono` WRITE; (6, 1),
/*!40000 ALTER TABLE `cliente_telefono` DISABLE KEYS */; (7, 1),
/*!40000 ALTER TABLE `cliente_telefono` ENABLE KEYS */; (8, 1),
UNLOCK TABLES; (9, 1);
-- INSERT INTO `libro_idioma`
-- Dumping data for table `compra` VALUES (1, 2),
-- (2, 2),
(3, 2),
LOCK TABLES `compra` WRITE; (4, 2),
/*!40000 ALTER TABLE `compra` DISABLE KEYS */; (5, 2),
/*!40000 ALTER TABLE `compra` ENABLE KEYS */; (6, 2),
UNLOCK TABLES; (7, 2),
(8, 2),
-- (9, 2);
-- Dumping data for table `correo`
-- INSERT INTO `trabajador`
VALUES (2, '19763899-0', 'Daniel', 'Cortes', 'Pincheira', '2019-06-13', '2019-06-13 16:04:42'),
LOCK TABLES `correo` WRITE; (3, '10768789-0', 'Trabajador', 'N', '2', '2019-06-13', '2019-06-13 16:05:17'),
/*!40000 ALTER TABLE `correo` DISABLE KEYS */; (4, '9717478-4', 'Trabajador', 'N', '3', '2019-06-13', '2019-06-13 16:05:27');
INSERT INTO `correo` VALUES (1,'HOOLA','2019-06-13 17:25:41'),(2,'skrd159@gmail.com','2019-06-13 17:32:13');
/*!40000 ALTER TABLE `correo` ENABLE KEYS */; INSERT INTO `trabajador_correo`
UNLOCK TABLES; VALUES (4, 1),
(2, 2);
--
-- Dumping data for table `direccion` INSERT INTO `usuario`
-- VALUES (2, 'admin', 0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27,
0x3564ECCCD85CF0583F9C090602E998B7, 2, '2019-06-13 16:04:53');
LOCK TABLES `direccion` WRITE;
/*!40000 ALTER TABLE `direccion` DISABLE KEYS */; set autocommit = 1;
/*!40000 ALTER TABLE `direccion` ENABLE KEYS */; set foreign_key_checks = 1;
UNLOCK TABLES;
commit;
--
-- Dumping data for table `cliente`
--
LOCK TABLES `cliente` WRITE;
/*!40000 ALTER TABLE `cliente` DISABLE KEYS */;
INSERT INTO `cliente` VALUES (2,1,'14166920-6','2019-06-13 03:08:17'),(3,2,'8425080-5','2019-06-13 03:08:23'),(4,1,'21629388-6','2019-06-13 03:08:25'),(5,1,'13510176-1','2019-06-13 03:08:27');
/*!40000 ALTER TABLE `cliente` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_correo`
--
LOCK TABLES `distribuidor_correo` WRITE;
/*!40000 ALTER TABLE `distribuidor_correo` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_direccion`
--
LOCK TABLES `distribuidor_direccion` WRITE;
/*!40000 ALTER TABLE `distribuidor_direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_telefono`
--
LOCK TABLES `distribuidor_telefono` WRITE;
/*!40000 ALTER TABLE `distribuidor_telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `editorial`
--
LOCK TABLES `editorial` WRITE;
/*!40000 ALTER TABLE `editorial` DISABLE KEYS */;
INSERT INTO `editorial` VALUES (1,'Editorial N1','2019-06-12 16:18:57'),(2,'Editorial N2','2019-06-12 16:18:57'),(3,'Editorial N3','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `editorial` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `ejemplar`
--
LOCK TABLES `ejemplar` WRITE;
/*!40000 ALTER TABLE `ejemplar` DISABLE KEYS */;
/*!40000 ALTER TABLE `ejemplar` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `empresa`
--
LOCK TABLES `empresa` WRITE;
/*!40000 ALTER TABLE `empresa` DISABLE KEYS */;
INSERT INTO `empresa` VALUES (1,'Empresa 1','2019-06-13 00:39:50'),(2,'Empresa 2','2019-06-13 00:39:52');
/*!40000 ALTER TABLE `empresa` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `estado`
--
LOCK TABLES `estado` WRITE;
/*!40000 ALTER TABLE `estado` DISABLE KEYS */;
INSERT INTO `estado` VALUES (1,'Vendido','2019-06-12 16:18:57'),(2,'Arrendado','2019-06-12 16:18:57'),(3,'Disponible','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `estado` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `factura`
--
LOCK TABLES `factura` WRITE;
/*!40000 ALTER TABLE `factura` DISABLE KEYS */;
/*!40000 ALTER TABLE `factura` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `idioma`
--
LOCK TABLES `idioma` WRITE;
/*!40000 ALTER TABLE `idioma` DISABLE KEYS */;
INSERT INTO `idioma` VALUES (1,'Español','2019-06-12 16:18:57'),(2,'Ingles','2019-06-12 16:18:57'),(3,'Portuges','2019-06-12 16:18:57'),(4,'Aleman','2019-06-12 16:18:57'),(5,'Ruso','2019-06-12 16:18:57'),(6,'Japones','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `idioma` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro`
--
LOCK TABLES `libro` WRITE;
/*!40000 ALTER TABLE `libro` DISABLE KEYS */;
INSERT INTO `libro` VALUES (1,1,'0-765-31178-X',2006,541,'Mistborn: The Final Empire',10000,'2019-06-12 16:18:57'),(2,1,'0-765-31688-9',2007,590,'Mistborn: The Well of Ascension',10000,'2019-06-12 16:18:57'),(3,1,'978-0-7653-1689-9',2008,572,'Mistborn: The Hero of Ages',10000,'2019-06-12 16:18:57'),(4,2,'1231231231232',1931,100,'The Shadow over Innsmouth',10000,'2019-06-12 16:18:57'),(5,2,'1231231231232',1933,100,'The Dreams in the Witch House',10000,'2019-06-12 16:18:57'),(6,2,'1231231231232',1936,100,'At the Mountains of Madness',10000,'2019-06-12 16:18:57'),(7,3,'0385086954',1974,199,'Carrie',10000,'2019-06-12 16:18:57'),(8,3,'978-0-670-26077-5',1979,428,'The Dead Zone',10000,'2019-06-12 16:18:57'),(9,3,'0-670-81302-8',1986,1138,'It',10000,'2019-06-12 16:18:57');
/*!40000 ALTER TABLE `libro` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_arriendo`
--
LOCK TABLES `libro_arriendo` WRITE;
/*!40000 ALTER TABLE `libro_arriendo` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_arriendo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_autor`
--
LOCK TABLES `libro_autor` WRITE;
/*!40000 ALTER TABLE `libro_autor` DISABLE KEYS */;
INSERT INTO `libro_autor` VALUES (1,3),(2,3),(3,3),(4,1),(5,1),(6,1),(7,2),(8,2),(9,2);
/*!40000 ALTER TABLE `libro_autor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_categoria`
--
LOCK TABLES `libro_categoria` WRITE;
/*!40000 ALTER TABLE `libro_categoria` DISABLE KEYS */;
INSERT INTO `libro_categoria` VALUES (1,3),(2,3),(3,3),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1);
/*!40000 ALTER TABLE `libro_categoria` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_compra`
--
LOCK TABLES `libro_compra` WRITE;
/*!40000 ALTER TABLE `libro_compra` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_compra` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_idioma`
--
LOCK TABLES `libro_idioma` WRITE;
/*!40000 ALTER TABLE `libro_idioma` DISABLE KEYS */;
INSERT INTO `libro_idioma` VALUES (1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2);
/*!40000 ALTER TABLE `libro_idioma` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_venta`
--
LOCK TABLES `libro_venta` WRITE;
/*!40000 ALTER TABLE `libro_venta` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_venta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `telefono`
--
LOCK TABLES `telefono` WRITE;
/*!40000 ALTER TABLE `telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador`
--
LOCK TABLES `trabajador` WRITE;
/*!40000 ALTER TABLE `trabajador` DISABLE KEYS */;
INSERT INTO `trabajador` VALUES (2,'19763899-0','Daniel','Cortes','Pincheira','2019-06-13','2019-06-13 16:04:42'),(3,'10768789-0','Trabajador','N','2','2019-06-13','2019-06-13 16:05:17'),(4,'9717478-4','Trabajador','N','3','2019-06-13','2019-06-13 16:05:27');
/*!40000 ALTER TABLE `trabajador` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_correo`
--
LOCK TABLES `trabajador_correo` WRITE;
/*!40000 ALTER TABLE `trabajador_correo` DISABLE KEYS */;
INSERT INTO `trabajador_correo` VALUES (4,1),(2,2);
/*!40000 ALTER TABLE `trabajador_correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_direccion`
--
LOCK TABLES `trabajador_direccion` WRITE;
/*!40000 ALTER TABLE `trabajador_direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `trabajador_direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_telefono`
--
LOCK TABLES `trabajador_telefono` WRITE;
/*!40000 ALTER TABLE `trabajador_telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `trabajador_telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (2,'admin',0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27,0x3564ECCCD85CF0583F9C090602E998B7,2,'2019-06-13 16:04:53');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `venta`
--
LOCK TABLES `venta` WRITE;
/*!40000 ALTER TABLE `venta` DISABLE KEYS */;
/*!40000 ALTER TABLE `venta` 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 */;
/*!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 2019-06-13 13:47:52

17
migrate.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
# Ask for password
printf "Pass: "
stty_orig=`stty -g` # save original terminal setting
stty -echo # turn-off echoing.
read PASS # read the password
stty $stty_orig # restore terminal setting.
echo ""
set -e
echo "Ejecutando create.sql"
mysql -u root -p$PASS biblioteca < create.sql
echo "Ejecutando data.sql"
mysql -u root -p$PASS biblioteca < data.sql