2006-11-17 10:14:43 +07:00
|
|
|
@Echo Adempiere Database Import $Revision: 1.3 $
|
|
|
|
|
|
|
|
@Rem $Id: ImportAdempiere.bat,v 1.3 2005/01/22 21:59:15 jjanke Exp $
|
|
|
|
|
2007-10-10 10:42:04 +07:00
|
|
|
@Echo Importing Adempiere DB from %ADEMPIERE_HOME%\data\Adempiere_pg.dmp (%ADEMPIERE_DB_NAME%)
|
2006-11-17 10:14:43 +07:00
|
|
|
|
|
|
|
@if (%ADEMPIERE_HOME%) == () goto environment
|
|
|
|
@if (%ADEMPIERE_DB_NAME%) == () goto environment
|
|
|
|
@Rem Must have parameters systemAccount AdempiereID AdempierePwd
|
|
|
|
@if (%1) == () goto usage
|
|
|
|
@if (%2) == () goto usage
|
|
|
|
@if (%3) == () goto usage
|
|
|
|
|
2007-10-10 10:42:04 +07:00
|
|
|
@set PGPASSWORD=%4
|
2006-11-17 10:14:43 +07:00
|
|
|
@echo -------------------------------------
|
2007-01-03 02:53:18 +07:00
|
|
|
@echo Re-Create user and database
|
2006-11-17 10:14:43 +07:00
|
|
|
@echo -------------------------------------
|
2007-01-03 02:53:18 +07:00
|
|
|
@dropdb -U postgres %ADEMPIERE_DB_NAME%
|
2007-05-01 23:16:12 +07:00
|
|
|
@dropuser -U postgres %2
|
|
|
|
@set ADEMPIERE_CREATE_ROLE_SQL=CREATE ROLE %2 SUPERUSER LOGIN PASSWORD '%3'
|
|
|
|
@psql -U postgres -c "%ADEMPIERE_CREATE_ROLE_SQL%"
|
|
|
|
@set ADEMPIERE_CREATE_ROLE_SQL=
|
|
|
|
|
2007-05-04 20:39:08 +07:00
|
|
|
@set PGPASSWORD=%3
|
2007-05-01 23:16:12 +07:00
|
|
|
@createdb %ADEMPIERE_DB_NAME% -E UNICODE -O %2 -U %2
|
2006-11-17 10:14:43 +07:00
|
|
|
|
|
|
|
@echo -------------------------------------
|
2007-01-03 02:53:18 +07:00
|
|
|
@echo Import Adempiere_pg.dmp
|
2006-11-17 10:14:43 +07:00
|
|
|
@echo -------------------------------------
|
2007-11-05 11:14:59 +07:00
|
|
|
@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%"
|
2007-05-01 23:16:12 +07:00
|
|
|
@psql -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
|
2007-11-05 11:14:59 +07:00
|
|
|
@set ADEMPIERE_ALTER_ROLE_SQL=
|
|
|
|
|
2006-11-17 10:14:43 +07:00
|
|
|
|
2007-05-04 20:39:08 +07:00
|
|
|
@set PGPASSWORD=
|
2006-11-17 10:14:43 +07:00
|
|
|
@goto end
|
|
|
|
|
|
|
|
:environment
|
|
|
|
@Echo Please make sure that the enviroment variables are set correctly:
|
|
|
|
@Echo ADEMPIERE_HOME e.g. D:\Adempiere
|
|
|
|
@Echo ADEMPIERE_DB_NAME e.g. dev1.adempiere.org
|
|
|
|
|
|
|
|
:usage
|
2007-10-10 10:42:04 +07:00
|
|
|
@echo Usage: %0 <systemAccount> <AdempiereID> <AdempierePwd> <PostgresPwd>
|
|
|
|
@echo Example: %0 postgres Adempiere Adempiere postgresPwd
|
2006-11-17 10:14:43 +07:00
|
|
|
|
|
|
|
:end
|