improve setup mysql, start make postgresql setup,added dbtype in options, data compress script and new extract data script method. bugfix: book images

This commit is contained in:
2021-12-04 14:46:25 -03:00
parent d07f704510
commit 39e02f0e40
56 changed files with 1050 additions and 348 deletions
+90
View File
@@ -0,0 +1,90 @@
7-Zip
~~~~~
License for use and distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7-Zip Copyright (C) 1999-2019 Igor Pavlov.
The licenses for files are:
1) 7z.dll:
- The "GNU LGPL" as main license for most of the code
- The "GNU LGPL" with "unRAR license restriction" for some code
- The "BSD 3-clause License" for some code
2) All other files: the "GNU LGPL".
Redistributions in binary form must reproduce related license information from this file.
Note:
You can use 7-Zip on any computer, including a computer in a commercial
organization. You don't need to register or pay for 7-Zip.
GNU LGPL information
--------------------
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You can receive a copy of the GNU Lesser General Public License from
http://www.gnu.org/
BSD 3-clause License
--------------------
The "BSD 3-clause License" is used for the code in 7z.dll that implements LZFSE data decompression.
That code was derived from the code in the "LZFSE compression library" developed by Apple Inc,
that also uses the "BSD 3-clause License":
----
Copyright (c) 2015-2016, Apple Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----
unRAR license restriction
-------------------------
The decompression engine for RAR archives was developed using source
code of unRAR program.
All copyrights to original unRAR code are owned by Alexander Roshal.
The license for original unRAR code has the following restriction:
The unRAR sources cannot be used to re-create the RAR compression algorithm,
which is proprietary. Distribution of modified unRAR sources in separate form
or as a part of other software is permitted, provided that it is clearly
stated in the documentation and source comments that the code may
not be used to develop a RAR (WinRAR) compatible archiver.
--
Igor Pavlov
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
@echo off
copy ..\dist\Librography.jar C:\Librography\
copy Librography.bat C:\Librography\
7z.exe a -tZip data C:\Librography\
rename data.zip data
Binary file not shown.
+354
View File
@@ -0,0 +1,354 @@
-- SQLINES DEMO *** rated by MySQL Workbench
-- 11/01/21 23:54:12
-- SQLINES DEMO *** Version: 1.0
-- SQLINES DEMO *** orward Engineering
/* SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; */
/* SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; */
/* SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; */
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy
-- SQLINES DEMO *** ------------------------------------
CREATE SCHEMA IF NOT EXISTS "applibrography";
-- TEMPLATE = template0
-- WITH OWNER "applibrography"
-- ENCODING 'UTF8' LC_COLLATE =
-- 'en_US.UTF-8'
-- LC_CTYPE = 'en_US.UTF-8';
SET SCHEMA 'applibrography' ;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_leitores`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_leitores_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_leitores (
id INT ZEROFILL NOT NULL DEFAULT NEXTVAL ('applibrography.tb_leitores_seq'),
nome VARCHAR(100) NULL,
rg VARCHAR(30) NULL DEFAULT NULL,
cpf VARCHAR(20) NULL DEFAULT NULL,
email VARCHAR(200) NULL DEFAULT NULL,
telefone VARCHAR(30) NULL DEFAULT NULL,
celular VARCHAR(30) NULL DEFAULT NULL,
cep VARCHAR(100) NULL DEFAULT NULL,
endereco VARCHAR(255) NULL DEFAULT NULL,
numero VARCHAR(50) NULL DEFAULT NULL,
complemento VARCHAR(200) NULL DEFAULT NULL,
bairro VARCHAR(100) NULL DEFAULT NULL,
cidade VARCHAR(100) NULL DEFAULT NULL,
estado VARCHAR(2) NULL DEFAULT NULL,
tipo VARCHAR(15) NULL,
is_locked SMALLINT NULL,
curso VARCHAR(45) NULL,
curso_ano VARCHAR(45) NULL,
qtd_emprestimos INT NULL,
emprestmax INT NULL,
observacoes VARCHAR(225) NULL,
PRIMARY KEY (id))
;
ALTER SEQUENCE applibrography.tb_leitores_seq RESTART WITH 00000100;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_fornecedores`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_fornecedores_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_fornecedores (
id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_fornecedores_seq'),
nome VARCHAR(100) NULL DEFAULT NULL,
cnpj VARCHAR(100) NULL DEFAULT NULL,
email VARCHAR(200) NULL DEFAULT NULL,
telefone VARCHAR(30) NULL DEFAULT NULL,
celular VARCHAR(30) NULL DEFAULT NULL,
cep VARCHAR(100) NULL DEFAULT NULL,
endereco VARCHAR(255) NULL DEFAULT NULL,
numero VARCHAR(50) NULL DEFAULT NULL,
complemento VARCHAR(200) NULL DEFAULT NULL,
bairro VARCHAR(100) NULL DEFAULT NULL,
cidade VARCHAR(100) NULL DEFAULT NULL,
estado VARCHAR(2) NULL DEFAULT NULL,
PRIMARY KEY (id))
;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_funcionarios`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_funcionarios_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_funcionarios (
id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_funcionarios_seq'),
nome VARCHAR(100) NOT NULL,
rg VARCHAR(30) NULL,
cpf VARCHAR(20) NULL,
email VARCHAR(200) NULL,
senha VARCHAR(10) NOT NULL,
cargo VARCHAR(100) NOT NULL,
nivel_acesso VARCHAR(50) NOT NULL,
telefone VARCHAR(30) NULL,
celular VARCHAR(30) NULL,
cep VARCHAR(100) NOT NULL,
endereco VARCHAR(255) NULL,
numero VARCHAR(50) NULL,
complemento VARCHAR(200) NULL,
bairro VARCHAR(100) NULL,
cidade VARCHAR(100) NOT NULL,
estado VARCHAR(2) NOT NULL,
PRIMARY KEY (id))
;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_livros`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_livros_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_livros (
id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_livros_seq'),
titulo VARCHAR(100) NOT NULL,
autor VARCHAR(45) NOT NULL,
editora VARCHAR(45) NOT NULL,
isbn VARCHAR(13) NOT NULL,
ano VARCHAR(4) NOT NULL,
serie VARCHAR(45) NULL,
edicao VARCHAR(45) NULL,
idioma VARCHAR(25) NOT NULL,
tb_fornecedores_id INT NULL,
piso VARCHAR(45) NULL,
corredor VARCHAR(45) NULL,
posicao VARCHAR(45) NULL,
secao VARCHAR(45) NULL,
disponibilidade VARCHAR(15) NOT NULL,
observacoes VARCHAR(225) NULL,
is_emprestado SMALLINT NULL,
PRIMARY KEY (id)
,
CONSTRAINT fk_tb_livros_tb_fornecedores1
FOREIGN KEY (tb_fornecedores_id)
REFERENCES applibrography.tb_fornecedores (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
;
CREATE INDEX fk_tb_livros_tb_fornecedores1_idx ON applibrography.tb_livros (tb_fornecedores_id ASC);
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_emprestimos`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_emprestimos_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_emprestimos (
id INT ZEROFILL NOT NULL DEFAULT NEXTVAL ('applibrography.tb_emprestimos_seq'),
data_emprestimo TIMESTAMP(0) NULL,
data_devolucao TIMESTAMP(0) NULL DEFAULT NULL,
observacoes TEXT NULL DEFAULT NULL,
tb_funcionarios_id INT NULL,
tb_livros_id INT NULL,
tb_livros_tb_fornecedores_id INT NULL,
tb_leitores_id INT ZEROFILL NULL,
data_entrega_agendada TIMESTAMP(0) NULL,
tb_funcionarios_iddevol INT NULL,
static_id_emprestimo INT NULL,
PRIMARY KEY (id)
,
CONSTRAINT fk_tb_emprestimos_tb_funcionarios1
FOREIGN KEY (tb_funcionarios_id)
REFERENCES applibrography.tb_funcionarios (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_tb_emprestimos_tb_livros1
FOREIGN KEY (tb_livros_id)
REFERENCES applibrography.tb_livros (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_tb_emprestimos_tb_leitores1
FOREIGN KEY (tb_leitores_id)
REFERENCES applibrography.tb_leitores (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_tb_emprestimos_tb_funcionarios2
FOREIGN KEY (tb_funcionarios_iddevol)
REFERENCES applibrography.tb_funcionarios (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
;
ALTER SEQUENCE applibrography.tb_emprestimos_seq RESTART WITH 10000000;
CREATE INDEX fk_tb_emprestimos_tb_funcionarios1_idx ON applibrography.tb_emprestimos (tb_funcionarios_id ASC);
CREATE INDEX fk_tb_emprestimos_tb_livros1_idx ON applibrography.tb_emprestimos (tb_livros_id ASC, tb_livros_tb_fornecedores_id ASC);
CREATE INDEX fk_tb_emprestimos_tb_leitores1_idx ON applibrography.tb_emprestimos (tb_leitores_id ASC);
CREATE INDEX fk_tb_emprestimos_tb_funcionarios2_idx ON applibrography.tb_emprestimos (tb_funcionarios_iddevol ASC);
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_multa`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_multa_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_multa (
idmulta INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_multa_seq'),
dias_atraso INT NOT NULL,
valor_multa DECIMAL(10,2) NULL,
esta_pago SMALLINT NULL,
tb_leitores_id INT ZEROFILL NOT NULL,
tb_emprestimos_id INT ZEROFILL NOT NULL,
PRIMARY KEY (idmulta, tb_emprestimos_id)
,
CONSTRAINT fk_multa_tb_leitores1
FOREIGN KEY (tb_leitores_id)
REFERENCES applibrography.tb_leitores (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT fk_tb_multa_tb_emprestimos1
FOREIGN KEY (tb_emprestimos_id)
REFERENCES applibrography.tb_emprestimos (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
;
CREATE INDEX fk_multa_tb_leitores1_idx ON applibrography.tb_multa (tb_leitores_id ASC);
CREATE INDEX fk_tb_multa_tb_emprestimos1_idx ON applibrography.tb_multa (tb_emprestimos_id ASC);
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_opcoes`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_opcoes_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_opcoes (
id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_opcoes_seq'),
data VARCHAR(45) NOT NULL,
parentid INT NULL,
PRIMARY KEY (id)
,
CONSTRAINT fk_Opcoes_Opcoes1
FOREIGN KEY (parentid)
REFERENCES applibrography.tb_opcoes (id)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
;
CREATE INDEX fk_Opcoes_Opcoes1_idx ON applibrography.tb_opcoes (parentid ASC);
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** aphy`.`tb_recibos`
-- SQLINES DEMO *** ------------------------------------
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE SEQUENCE applibrography.tb_recibos_seq;
CREATE TABLE IF NOT EXISTS applibrography.tb_recibos (
id INT NOT NULL DEFAULT NEXTVAL ('applibrography.tb_recibos_seq'),
emprestimo_id INT NULL,
data_emprestimo VARCHAR(45) NULL,
data_devolucao_agendada VARCHAR(45) NULL,
data_entrega VARCHAR(45) NULL,
livro VARCHAR(45) NULL,
usuario VARCHAR(45) NULL,
tipo VARCHAR(45) NULL,
multa VARCHAR(45) NULL,
status VARCHAR(45) NULL,
funcionario VARCHAR(45) NULL,
PRIMARY KEY (id))
;
/* SET SQL_MODE=@OLD_SQL_MODE; */
/* SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; */
/* SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; */
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** pplibrography`.`tb_leitores`
-- SQLINES DEMO *** ------------------------------------
START TRANSACTION;
SET SCHEMA 'applibrography';
INSERT INTO applibrography.tb_leitores (id, nome, rg, cpf, email, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado, tipo, is_locked, curso, curso_ano, qtd_emprestimos, emprestmax, observacoes) VALUES (00000101, 'Leitor Teste', '5.432.234-1', '099.999.345-23', 'leitor@mail.com', '(42)98877-2299', '(42)98877-2299', '854670-000', 'Rua 1 de abril', '13', 'casa', 'Centro', 'Mallet', 'PR', 'Estudante', 0, 'Letras', '1', 0, 123, 'Ok');
COMMIT;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** pplibrography`.`tb_fornecedores`
-- SQLINES DEMO *** ------------------------------------
START TRANSACTION;
SET SCHEMA 'applibrography';
INSERT INTO applibrography.tb_fornecedores (id, nome, cnpj, email, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado) VALUES (1, 'Fornecedor Teste', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
COMMIT;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** pplibrography`.`tb_funcionarios`
-- SQLINES DEMO *** ------------------------------------
START TRANSACTION;
SET SCHEMA 'applibrography';
INSERT INTO applibrography.tb_funcionarios (id, nome, rg, cpf, email, senha, cargo, nivel_acesso, telefone, celular, cep, endereco, numero, complemento, bairro, cidade, estado) VALUES (1, 'Administrador', NULL, NULL, 'admin@admin', 'admin', 'Administrador', 'Administrador', NULL, NULL, '84570-000', NULL, NULL, NULL, NULL, 'Mallet', 'PR');
COMMIT;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** pplibrography`.`tb_livros`
-- SQLINES DEMO *** ------------------------------------
START TRANSACTION;
SET SCHEMA 'applibrography';
INSERT INTO applibrography.tb_livros (id, titulo, autor, editora, isbn, ano, serie, edicao, idioma, tb_fornecedores_id, piso, corredor, posicao, secao, disponibilidade, observacoes, is_emprestado) VALUES (1, 'Alice no Pis das maravilhas', 'Lewis Carrol', 'Nope', '1231231231231', '1894', '1', '1', 'Portugues', 1, NULL, NULL, NULL, 'Literatura Universal', '5', 'ok', 0);
COMMIT;
-- SQLINES DEMO *** ------------------------------------
-- SQLINES DEMO *** pplibrography`.`tb_opcoes`
-- SQLINES DEMO *** ------------------------------------
START TRANSACTION;
SET SCHEMA 'applibrography';
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (1, 'piso', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (2, 'corredor', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (3, 'secao', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (4, 'posicao', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (5, 'disponibilidade', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (6, 'printerurl', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (7, 'instituicaonome', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (8, 'instiuicaoendereco', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (17, 'piso 1', 1);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (20, 'corredor 1', 2);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (21, '1A', 3);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (22, 'Literatura Universal', 4);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (13, '0', 5);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (14, '3', 5);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (15, 'Biblioteca de Hogwarts', 7);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (16, 'Rua Epsilon, 888, Cidade Imaginaria, LA ', 8);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (9, 'tiposdeusuarios', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (18, 'Estudante', 9);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (19, 'Professor', 9);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (10, 'server url', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (11, 'libraryname', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (12, 'libraryAddress', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (23, '127.0.0.1', 12);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (24, 'Nome da Biblioteca', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (25, 'valor_multa', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (26, '300', 25);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (27, 'MsgReceipt', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (28, 'Obrigado!!', 27);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (29, 'theme', NULL);
INSERT INTO applibrography.tb_opcoes (id, data, parentid) VALUES (30, 'dark', 29);
COMMIT;
+62
View File
@@ -0,0 +1,62 @@
@echo off
:start
PATH=C:\Librography_data\postgres\bin;%path%
netstat -o -n -a | findstr 5432
if %ERRORLEVEL% equ 0 goto FOUND
echo Postgresql not found or not usisng default port 5432...
ECHO Do you wanto open open browser to download it?
ECHO 1. yes
ECHO 2. no
set /p choice=Choose your option.
if '%choice%'=='' ECHO "%choice%" is not valid please try again
if '%choice%'=='1' goto open
if '%choice%'=='2' goto FIN
ECHO.
goto start
:open
echo opening the Postgresql download link....
pause
START Https://www.enterprisedb.com/postgresql-tutorial-resources-training?uuid=ea5c8104-3940-4ed1-b427-81cf19781581&campaignId=70138000000rYFmAAM
ECHO 1 - Download the setup from link opening on browser and after install and then we will continue the setup
ECHO 2 - Install with optiion "Only Server" and setup a root password
ECHO 3 - take a note of the root password, fisnish the installer and continue this setup
Rem %Downloads%/postgresql-10.19-1-windows-x64.exe --mode unattended --unattendedmodeui minimal --superpassword MIRANDA --prefix C:\Librography_data\postgres --datadir C:\Librography_data\postgres\data
pause
Rem :continue
Rem echo ok
goto start
Rem goto FIN
:FOUND
echo port found. It mean the Postgresql is installed
echo we can continue the setup...
pause
:FIN
echo .
echo .
@echo off
rem ------------------------------------------------
echo Creating access to user. Waiting ...
echo Enter the Postgresql user password:
set /p rootpassword=
set dbname=applibrography
set dbuser=applibrography
set userpassword=gowl
set PGPASSWORD=MIRANDA
Rem "C:\Program Files\MySQL\MySQL Server 5.7\bin\mysql.exe" "--defaults-file=C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" "-uroot" "-p"
SET PATH=%PATH%;C:\Librography_data\postgres\bin
psql -U postgres -c "CREATE DATABASE %dbname%;"
psql -U postgres -c "CREATE USER '%dbuser%'@'localhost' IDENTIFIED BY '%userpassword%';"
psql -U postgres -c "GRANT ALL PRIVILEGES ON %dbuser%.* TO '%dbuser%'@'localhost';"
psql -U postgres -c "FLUSH PRIVILEGES;"
psql -U postgres -c "source script-posgresql.sql"
echo Done.
echo "Postgresql user created."
echo "Username: %dbuser%"
echo "Password: %userpassword%"
rem ------------------------------------------------
echo .
echo .