BT [ 2063691 ] Postgresql scripts should specify database host
https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2063691&group_id=176962 Added host and port to postgresql scripts
This commit is contained in:
parent
becce9b627
commit
cdb5a5f46f
|
@ -21,6 +21,7 @@
|
||||||
@SET ADEMPIERE_DB_USER=@ADEMPIERE_DB_USER@
|
@SET ADEMPIERE_DB_USER=@ADEMPIERE_DB_USER@
|
||||||
@SET ADEMPIERE_DB_PASSWORD=@ADEMPIERE_DB_PASSWORD@
|
@SET ADEMPIERE_DB_PASSWORD=@ADEMPIERE_DB_PASSWORD@
|
||||||
@SET ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@
|
@SET ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@
|
||||||
|
@SET ADEMPIERE_DB_PORT=@ADEMPIERE_DB_PORT@
|
||||||
|
|
||||||
@Rem Oracle specifics
|
@Rem Oracle specifics
|
||||||
@SET ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@
|
@SET ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@
|
||||||
|
|
|
@ -31,6 +31,8 @@ ADEMPIERE_DB_PASSWORD=@ADEMPIERE_DB_PASSWORD@
|
||||||
export ADEMPIERE_DB_PASSWORD
|
export ADEMPIERE_DB_PASSWORD
|
||||||
ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@
|
ADEMPIERE_DB_URL=@ADEMPIERE_DB_URL@
|
||||||
export ADEMPIERE_DB_URL
|
export ADEMPIERE_DB_URL
|
||||||
|
ADEMPIERE_DB_PORT=@ADEMPIERE_DB_PORT@
|
||||||
|
export ADEMPIERE_DB_PORT
|
||||||
|
|
||||||
# Oracle Specifics ...
|
# Oracle Specifics ...
|
||||||
ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@
|
ADEMPIERE_DB_PATH=@ADEMPIERE_DB_PATH@
|
||||||
|
|
|
@ -6,11 +6,13 @@
|
||||||
|
|
||||||
@if (%ADEMPIERE_HOME%) == () goto environment
|
@if (%ADEMPIERE_HOME%) == () goto environment
|
||||||
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_SERVER%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_PORT%) == () goto environment
|
||||||
@Rem Must have parameter: userAccount
|
@Rem Must have parameter: userAccount
|
||||||
@if (%1) == () goto usage
|
@if (%1) == () goto usage
|
||||||
|
|
||||||
@set PGPASSWORD=%2
|
@set PGPASSWORD=%2
|
||||||
pg_dump -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp
|
pg_dump -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp
|
||||||
@set PGPASSWORD=
|
@set PGPASSWORD=
|
||||||
|
|
||||||
@cd %ADEMPIERE_HOME%\Data
|
@cd %ADEMPIERE_HOME%\Data
|
||||||
|
@ -21,7 +23,9 @@ pg_dump -U %1 %ADEMPIERE_DB_NAME% > %ADEMPIERE_HOME%\data\ExpDat.dmp
|
||||||
:environment
|
:environment
|
||||||
@Echo Please make sure that the enviroment variables are set correctly:
|
@Echo Please make sure that the enviroment variables are set correctly:
|
||||||
@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2
|
@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2
|
||||||
@Echo ADEMPIERE_DB_NAME e.g. ADEMPIERE.ADEMPIERE.org
|
@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe
|
||||||
|
@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org
|
||||||
|
@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521
|
||||||
|
|
||||||
:usage
|
:usage
|
||||||
@echo Usage: %0 <userAccount>
|
@echo Usage: %0 <userAccount>
|
||||||
|
|
|
@ -10,17 +10,21 @@ if [ $# -eq 0 ]
|
||||||
echo "Example: $0 adempiere adempiere"
|
echo "Example: $0 adempiere adempiere"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
|
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ]
|
||||||
then
|
then
|
||||||
echo "Please make sure that the environment variables are set correctly:"
|
echo "Please make sure that the environment variables are set correctly:"
|
||||||
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
||||||
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
|
echo " ADEMPIERE_DB_NAME e.g. adempiere or xe"
|
||||||
|
echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org"
|
||||||
|
echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PGPASSWORD=$2
|
PGPASSWORD=$2
|
||||||
pg_dump --no-owner -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp
|
export PGPASSWORD
|
||||||
export PGPASSWORD=
|
pg_dump -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT --no-owner -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp
|
||||||
|
PGPASSWORD=
|
||||||
|
export PGPASSWORD
|
||||||
|
|
||||||
cd $ADEMPIERE_HOME/data
|
cd $ADEMPIERE_HOME/data
|
||||||
jar cvfM ExpDat.jar ExpDat.dmp
|
jar cvfM ExpDat.jar ExpDat.dmp
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
@if (%ADEMPIERE_HOME%) == () goto environment
|
@if (%ADEMPIERE_HOME%) == () goto environment
|
||||||
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_SERVER%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_PORT%) == () goto environment
|
||||||
@Rem Must have parameters systemAccount AdempiereID AdempierePwd PostgresPwd
|
@Rem Must have parameters systemAccount AdempiereID AdempierePwd PostgresPwd
|
||||||
@if (%1) == () goto usage
|
@if (%1) == () goto usage
|
||||||
@if (%2) == () goto usage
|
@if (%2) == () goto usage
|
||||||
|
@ -16,28 +18,30 @@
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@echo Re-Create user and database
|
@echo Re-Create user and database
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@dropdb -U postgres %ADEMPIERE_DB_NAME%
|
@dropdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %ADEMPIERE_DB_NAME%
|
||||||
@dropuser -U postgres %2
|
@dropuser -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %2
|
||||||
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
|
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
|
||||||
@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
|
||||||
@set ADEMPIERE_CREATE_ROLE_SQL=
|
@set ADEMPIERE_CREATE_ROLE_SQL=
|
||||||
|
|
||||||
@set PGPASSWORD=%3
|
@set PGPASSWORD=%3
|
||||||
@createdb -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME%
|
@createdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME%
|
||||||
|
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@echo Import Adempiere_pg.dmp
|
@echo Import Adempiere_pg.dmp
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade"
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade"
|
||||||
@psql -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/ExpDat.dmp
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/ExpDat.dmp
|
||||||
|
|
||||||
@set PGPASSWORD=
|
@set PGPASSWORD=
|
||||||
@goto end
|
@goto end
|
||||||
|
|
||||||
:environment
|
:environment
|
||||||
@Echo Please make sure that the enviroment variables are set correctly:
|
@Echo Please make sure that the enviroment variables are set correctly:
|
||||||
@Echo ADEMPIERE_HOME e.g. D:\Adempiere
|
@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2
|
||||||
@Echo ADEMPIERE_DB_NAME e.g. dev1.adempiere.org
|
@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe
|
||||||
|
@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org
|
||||||
|
@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521
|
||||||
|
|
||||||
:usage
|
:usage
|
||||||
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <postgresPwd>
|
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <postgresPwd>
|
||||||
|
|
|
@ -9,34 +9,39 @@ if [ $# -le 2 ]
|
||||||
echo "Example: $0 postgres adempiere adempiere postgrespwd"
|
echo "Example: $0 postgres adempiere adempiere postgrespwd"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
|
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ]
|
||||||
then
|
then
|
||||||
echo "Please make sure that the environment variables are set correctly:"
|
echo "Please make sure that the environment variables are set correctly:"
|
||||||
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
||||||
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
|
echo " ADEMPIERE_DB_NAME e.g. adempiere or xe"
|
||||||
|
echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org"
|
||||||
|
echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
export PGPASSWORD=$4
|
PGPASSWORD=$4
|
||||||
|
export PGPASSWORD
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
echo Recreate user and database
|
echo Recreate user and database
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
dropdb -U postgres $ADEMPIERE_DB_NAME
|
dropdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $ADEMPIERE_DB_NAME
|
||||||
|
|
||||||
dropuser -U postgres $2
|
dropuser -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $2
|
||||||
|
|
||||||
ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'"
|
ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'"
|
||||||
psql -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL"
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL"
|
||||||
ADEMPIERE_CREATE_ROLE_SQL=
|
ADEMPIERE_CREATE_ROLE_SQL=
|
||||||
|
|
||||||
export PGPASSWORD=$3
|
PGPASSWORD=$3
|
||||||
createdb -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME
|
export PGPASSWORD
|
||||||
|
createdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME
|
||||||
|
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
echo Import Adempiere_pg.dmp
|
echo Import Adempiere_pg.dmp
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/ExpDat.dmp
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/ExpDat.dmp
|
||||||
|
|
||||||
export PGPASSWORD=
|
PGPASSWORD=
|
||||||
|
export PGPASSWORD
|
||||||
|
|
|
@ -4,17 +4,21 @@ echo Adempiere PostgreSQL Database Export $Revision: 1.3 $
|
||||||
|
|
||||||
echo Saving database reference@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
echo Saving database reference@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
||||||
|
|
||||||
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
|
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ]
|
||||||
then
|
then
|
||||||
echo "Please make sure that the environment variables are set correctly:"
|
echo "Please make sure that the environment variables are set correctly:"
|
||||||
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
||||||
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
|
echo " ADEMPIERE_DB_NAME e.g. adempiere or xe"
|
||||||
|
echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org"
|
||||||
|
echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PGPASSWORD=reference
|
PGPASSWORD=reference
|
||||||
pg_dump --no-owner -U reference $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
export PGPASSWORD
|
||||||
export PGPASSWORD=
|
pg_dump -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT --no-owner -U reference $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
||||||
|
PGPASSWORD=
|
||||||
|
export PGPASSWORD
|
||||||
|
|
||||||
cd $ADEMPIERE_HOME/data
|
cd $ADEMPIERE_HOME/data
|
||||||
jar cvfM Adempiere_pg.jar Adempiere_pg.dmp
|
jar cvfM Adempiere_pg.jar Adempiere_pg.dmp
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
@if (%ADEMPIERE_HOME%) == () goto environment
|
@if (%ADEMPIERE_HOME%) == () goto environment
|
||||||
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_SERVER%) == () goto environment
|
||||||
|
@if (%ADEMPIERE_DB_PORT%) == () goto environment
|
||||||
@Rem Must have parameters systemAccount AdempiereID AdempierePwd
|
@Rem Must have parameters systemAccount AdempiereID AdempierePwd
|
||||||
@if (%1) == () goto usage
|
@if (%1) == () goto usage
|
||||||
@if (%2) == () goto usage
|
@if (%2) == () goto usage
|
||||||
|
@ -15,22 +17,22 @@
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@echo Re-Create user and database
|
@echo Re-Create user and database
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@dropdb -U postgres %ADEMPIERE_DB_NAME%
|
@dropdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %ADEMPIERE_DB_NAME%
|
||||||
@dropuser -U postgres %2
|
@dropuser -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres %2
|
||||||
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
|
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
|
||||||
@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
|
||||||
@set ADEMPIERE_CREATE_ROLE_SQL=
|
@set ADEMPIERE_CREATE_ROLE_SQL=
|
||||||
|
|
||||||
@set PGPASSWORD=%3
|
@set PGPASSWORD=%3
|
||||||
@createdb -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME%
|
@createdb -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -E UNICODE -O %2 -U %2 %ADEMPIERE_DB_NAME%
|
||||||
|
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@echo Import Adempiere_pg.dmp
|
@echo Import Adempiere_pg.dmp
|
||||||
@echo -------------------------------------
|
@echo -------------------------------------
|
||||||
@set ADEMPIERE_ALTER_ROLE_SQL=ALTER ROLE %2 SET search_path TO adempiere, sqlj, pg_catalog
|
@set ADEMPIERE_ALTER_ROLE_SQL=ALTER ROLE %2 SET search_path TO adempiere, sqlj, pg_catalog
|
||||||
@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "%ADEMPIERE_ALTER_ROLE_SQL%"
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "%ADEMPIERE_ALTER_ROLE_SQL%"
|
||||||
@psql -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade"
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -c "drop schema sqlj cascade"
|
||||||
@psql -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/Adempiere_pg.dmp
|
@psql -h %ADEMPIERE_DB_SERVER% -p %ADEMPIERE_DB_PORT% -d %ADEMPIERE_DB_NAME% -U %2 -f %ADEMPIERE_HOME%/data/Adempiere_pg.dmp
|
||||||
@set ADEMPIERE_ALTER_ROLE_SQL=
|
@set ADEMPIERE_ALTER_ROLE_SQL=
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,8 +41,10 @@
|
||||||
|
|
||||||
:environment
|
:environment
|
||||||
@Echo Please make sure that the enviroment variables are set correctly:
|
@Echo Please make sure that the enviroment variables are set correctly:
|
||||||
@Echo ADEMPIERE_HOME e.g. D:\Adempiere
|
@Echo ADEMPIERE_HOME e.g. D:\ADEMPIERE2
|
||||||
@Echo ADEMPIERE_DB_NAME e.g. dev1.adempiere.org
|
@Echo ADEMPIERE_DB_NAME e.g. adempiere or xe
|
||||||
|
@Echo ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org
|
||||||
|
@Echo ADEMPIERE_DB_PORT e.g. 5432 or 1521
|
||||||
|
|
||||||
:usage
|
:usage
|
||||||
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <PostgresPwd>
|
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <PostgresPwd>
|
||||||
|
|
|
@ -9,36 +9,40 @@ if [ $# -le 2 ]
|
||||||
echo "Example: $0 postgres adempiere adempiere postgresPwd"
|
echo "Example: $0 postgres adempiere adempiere postgresPwd"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
|
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ]
|
||||||
then
|
then
|
||||||
echo "Please make sure that the environment variables are set correctly:"
|
echo "Please make sure that the environment variables are set correctly:"
|
||||||
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
||||||
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
|
echo " ADEMPIERE_DB_NAME e.g. adempiere or xe"
|
||||||
|
echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org"
|
||||||
|
echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PGPASSWORD=$4
|
||||||
export PGPASSWORD=$4
|
export PGPASSWORD
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
echo Recreate user and database
|
echo Recreate user and database
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
dropdb -U postgres $ADEMPIERE_DB_NAME
|
dropdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $ADEMPIERE_DB_NAME
|
||||||
|
|
||||||
dropuser -U postgres $2
|
dropuser -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres $2
|
||||||
|
|
||||||
ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'"
|
ADEMPIERE_CREATE_ROLE_SQL="CREATE ROLE $2 SUPERUSER LOGIN PASSWORD '$3'"
|
||||||
psql -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL"
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -U postgres -c "$ADEMPIERE_CREATE_ROLE_SQL"
|
||||||
ADEMPIERE_CREATE_ROLE_SQL=
|
ADEMPIERE_CREATE_ROLE_SQL=
|
||||||
|
|
||||||
export PGPASSWORD=$3
|
PGPASSWORD=$3
|
||||||
createdb -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME
|
export PGPASSWORD
|
||||||
|
createdb -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -E UNICODE -O $2 -U $2 $ADEMPIERE_DB_NAME
|
||||||
|
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
echo Import Adempiere_pg.dmp
|
echo Import Adempiere_pg.dmp
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
ADEMPIERE_ALTER_ROLE_SQL="ALTER ROLE $2 SET search_path TO adempiere, sqlj, pg_catalog"
|
ADEMPIERE_ALTER_ROLE_SQL="ALTER ROLE $2 SET search_path TO adempiere, sqlj, pg_catalog"
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -c "$ADEMPIERE_ALTER_ROLE_SQL"
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "$ADEMPIERE_ALTER_ROLE_SQL"
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/Adempiere_pg.dmp
|
||||||
ADEMPIERE_ALTER_ROLE_SQL=
|
ADEMPIERE_ALTER_ROLE_SQL=
|
||||||
export PGPASSWORD=
|
PGPASSWORD=
|
||||||
|
export PGPASSWORD
|
||||||
|
|
|
@ -7,17 +7,21 @@ if [ $# -le 2 ]
|
||||||
echo "Example: $0 postgres adempiere adempiere postgresPwd"
|
echo "Example: $0 postgres adempiere adempiere postgresPwd"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
|
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" -o "$ADEMPIERE_DB_SERVER" = "" -o "$ADEMPIERE_DB_PORT" = "" ]
|
||||||
then
|
then
|
||||||
echo "Please make sure that the environment variables are set correctly:"
|
echo "Please make sure that the environment variables are set correctly:"
|
||||||
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
echo " ADEMPIERE_HOME e.g. /Adempiere"
|
||||||
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
|
echo " ADEMPIERE_DB_NAME e.g. adempiere or xe"
|
||||||
|
echo " ADEMPIERE_DB_SERVER e.g. dbserver.adempiere.org"
|
||||||
|
echo " ADEMPIERE_DB_PORT e.g. 5432 or 1521"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export PGPASSWORD=$3
|
PGPASSWORD=$3
|
||||||
|
export PGPASSWORD
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
echo Add missing translations
|
echo Add missing translations
|
||||||
echo -------------------------------------
|
echo -------------------------------------
|
||||||
psql -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql
|
psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql
|
||||||
export PGPASSWORD=
|
PGPASSWORD=
|
||||||
|
export PGPASSWORD
|
||||||
|
|
Loading…
Reference in New Issue