Preparing for nightly build

This commit is contained in:
Heng Sin Low 2007-11-02 09:51:12 +00:00
parent 085c094efe
commit 8793fa8f6b
10 changed files with 292 additions and 6 deletions

View File

@ -8,12 +8,19 @@ fi
. ./myEnvironment.sh Server
echo Import Reference - $ADEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
SUFFIX=""
SYSUSER=system
if [ $ADEMPIERE_DB_PATH = "postgresql" ]
then
SUFFIX="_pg"
SYSUSER=postgres
fi
echo Re-Create Reference User and import $ADEMPIERE_HOME/data/Adempiere.dmp - \($ADEMPIERE_DB_NAME\)
echo == The import will show warnings. This is OK ==
ls -lsa $ADEMPIERE_HOME/data/Adempiere.dmp
ls -lsa $ADEMPIERE_HOME/data/Adempiere${SUFFIX}.dmp
echo Press enter to continue ...
read in
# Parameter: <systemAccount> <AdempiereID> <AdempierePwd>
sh $ADEMPIERE_DB_PATH/ImportAdempiere.sh system/$ADEMPIERE_DB_SYSTEM reference reference
sh $ADEMPIERE_DB_PATH/ImportAdempiere.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM reference reference $ADEMPIERE_DB_SYSTEM

View File

@ -0,0 +1,73 @@
#!/bin/sh
#
# $Id: RUN_ImportAdempiere.sh,v 1.9 2005/01/22 21:59:15 jjanke Exp $
if [ $ADEMPIERE_HOME ]; then
cd $ADEMPIERE_HOME/utils
fi
. ./myEnvironment.sh Server
#check java home
if [ $JAVA_HOME ]; then
export PATH=$JAVA_HOME/bin:$PATH
else
echo JAVA_HOME is not set.
echo You may not be able to build Adempiere
echo Set JAVA_HOME to the directory of your local JDK.
exit
fi
# check jdk
if [ ! -f $JAVA_HOME/lib/tools.jar ] ; then
echo "** Need full Java SDK **"
exit
fi
SUFFIX=""
SYSUSER=system
if [ $ADEMPIERE_DB_PATH = "postgresql" ]
then
SUFFIX="_pg"
SYSUSER=postgres
fi
#classpath
MYCLASSPATH=../lib/Adempiere.jar:../lib/CCTools.jar:../lib/postgresql.jar:../lib/oracle.jar:../lib/jboss.jar
JAVA_OPTS="-Xms128m -Xmx512m -Djava.awt.headless=true"
ADEMPIERE_OPTS="-DADEMPIERE_HOME=$ADEMPIERE_HOME -DPropertyFile=../Adempiere.properties"
#Run generate model
echo
echo Generate Model
echo
$JAVA_HOME/bin/java $JAVA_OPTS $ADEMPIERE_OPTS -classpath $MYCLASSPATH org.adempiere.util.GenerateModel src/org/compiere/model org.compiere.model 'D' '%'
#Add missing translations
echo
echo Add missing translations
echo
# Parameter: <systemAccount> <AdempiereID> <AdempierePwd> <SystemPwd>
sh $ADEMPIERE_DB_PATH/PostMigration.sh $SYSUSER/$ADEMPIERE_DB_SYSTEM $ADEMPIERE_DB_USER $ADEMPIERE_DB_PASSWORD $ADEMPIERE_DB_SYSTEM
#Run Synchronized Terminology
echo
echo Synchronized Terminology
echo
$JAVA_HOME/bin/java $JAVA_OPTS $ADEMPIERE_OPTS -classpath $MYCLASSPATH org.compiere.process.SynchronizeTerminology
#Run Sequence Check
echo
echo Sequence Check
echo
$JAVA_HOME/bin/java $JAVA_OPTS $ADEMPIERE_OPTS -classpath $MYCLASSPATH org.compiere.process.SequenceCheck
echo Done ...
exit 0

View File

@ -0,0 +1,67 @@
DECLARE
ins VARCHAR2 (2000);
sel VARCHAR2 (2000);
inssel VARCHAR2 (4001);
table_id NUMBER;
BEGIN
ins := RPAD (' ', 2000, ' ');
sel := RPAD (' ', 2000, ' ');
inssel := RPAD (' ', 4001, ' ');
DBMS_OUTPUT.PUT_LINE ('Start');
FOR t IN (SELECT ad_table_id,
SUBSTR (tablename, 1, LENGTH (tablename) - 4) tablename
FROM AD_TABLE
WHERE tablename LIKE '%_Trl' AND isactive = 'Y'
AND isview = 'N')
LOOP
ins :=
'INSERT INTO '
|| t.tablename
|| '_TRL ('
|| 'ad_language,ad_client_id,ad_org_id,created,createdby,updated,updatedby,isactive,istranslated,'
|| t.tablename
|| '_id';
sel :=
'SELECT l.ad_language,t.ad_client_id,t.ad_org_id,t.created,t.createdby,t.updated,t.updatedby,t.isactive,''N'' as istranslated,'
|| t.tablename
|| '_id';
SELECT ad_table_id
INTO table_id
FROM AD_TABLE
WHERE tablename = t.tablename;
FOR c IN (SELECT col.columnname
FROM AD_COLUMN col INNER JOIN AD_TABLE tab
ON (col.ad_table_id = tab.ad_table_id)
WHERE col.ad_table_id = table_id
AND col.istranslated = 'Y'
AND col.isactive = 'Y'
ORDER BY 1)
LOOP
ins := TRIM (ins) || ',' || TRIM (c.columnname);
sel := TRIM (sel) || ',t.' || TRIM (c.columnname);
END LOOP;
ins := TRIM (ins) || ')';
sel :=
TRIM (sel)
|| ' from '
|| t.tablename
|| ' t, ad_language l WHERE l.issystemlanguage=''Y'' AND NOT EXISTS (SELECT 1 FROM '
|| t.tablename
|| '_TRL b WHERE b.'
|| t.tablename
|| '_id=t.'
|| t.tablename
|| '_id AND b.AD_LANGUAGE=l.AD_LANGUAGE)';
inssel := TRIM (ins) || ' ' || TRIM (sel);
DBMS_OUTPUT.PUT_LINE (inssel);
EXECUTE IMMEDIATE inssel;
END LOOP;
DBMS_OUTPUT.PUT_LINE ('End');
COMMIT;
END;

View File

@ -0,0 +1,23 @@
# $Id: ImportAdempiere.sh,v 1.10 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Import $Revision: 1.10 $
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/Adempiere.dmp
if [ $# -le 2 ]
then
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD>"
echo "Example: $0 system/manager adempiere adempiere"
exit 1
fi
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
then
echo "Please make sure that the environment variables are set correctly:"
echo " ADEMPIERE_HOME e.g. /Adempiere"
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
exit 1
fi
echo -------------------------------------
echo Add missing translations
echo -------------------------------------
echo sqlplus $2/$3@$ADEMPIERE_DB_SERVER/$ADEMPIERE_DB_NAME @$ADEMPIERE_HOME/utils/$ADEMPIERE_DB_PATH/01_add_missing_Translations.sql

View File

@ -0,0 +1,69 @@
CREATE OR REPLACE FUNCTION add_missing_translations() RETURNS void as $func$
DECLARE
ins VARCHAR (2000);
sel VARCHAR (2000);
inssel VARCHAR (4001);
table_id NUMERIC;
t RECORD;
c RECORD;
BEGIN
FOR t IN (SELECT ad_table_id,
SUBSTR (tablename, 1, LENGTH (tablename) - 4) as tablename
FROM AD_TABLE
WHERE tablename LIKE '%_Trl' AND isactive = 'Y'
AND isview = 'N')
LOOP
ins :=
'INSERT INTO '
|| t.tablename
|| '_TRL ('
|| 'ad_language,ad_client_id,ad_org_id,created,createdby,updated,updatedby,isactive,istranslated,'
|| t.tablename
|| '_id';
sel :=
'SELECT l.ad_language,t.ad_client_id,t.ad_org_id,t.created,t.createdby,t.updated,t.updatedby,t.isactive,''N'' as istranslated,'
|| t.tablename
|| '_id';
SELECT ad_table_id
INTO table_id
FROM AD_TABLE
WHERE tablename = t.tablename;
FOR c IN (SELECT col.columnname
FROM AD_COLUMN col INNER JOIN AD_TABLE tab
ON (col.ad_table_id = tab.ad_table_id)
WHERE col.ad_table_id = table_id
AND col.istranslated = 'Y'
AND col.isactive = 'Y'
ORDER BY 1)
LOOP
ins := TRIM (ins) || ',' || TRIM (c.columnname);
sel := TRIM (sel) || ',t.' || TRIM (c.columnname);
END LOOP;
ins := TRIM (ins) || ')';
sel :=
TRIM (sel)
|| ' from '
|| t.tablename
|| ' t, ad_language l WHERE l.issystemlanguage=''Y'' AND NOT EXISTS (SELECT 1 FROM '
|| t.tablename
|| '_TRL b WHERE b.'
|| t.tablename
|| '_id=t.'
|| t.tablename
|| '_id AND b.AD_LANGUAGE=l.AD_LANGUAGE)';
inssel := TRIM (ins) || ' ' || TRIM (sel);
EXECUTE inssel;
END LOOP;
END;
$func$ LANGUAGE plpgsql;
select add_missing_translations();
commit;

View File

@ -19,7 +19,7 @@ if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
fi
export PGPASSWORD=$2
pg_dump -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp
pg_dump --no-owner -U $1 $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/ExpDat.dmp
export PGPASSWORD=
cd $ADEMPIERE_HOME/data

View File

@ -39,4 +39,4 @@ echo -------------------------------------
psql -d $ADEMPIERE_DB_NAME -U $2 -c "drop schema sqlj cascade"
psql -d $ADEMPIERE_DB_NAME -U $2 -f $ADEMPIERE_HOME/data/ExpDat.dmp
export PGPASSWORD=
export PGPASSWORD=

View File

@ -0,0 +1,20 @@
echo Adempiere PostgreSQL Database Export $Revision: 1.3 $
# $Id: DBExport.sh,v 1.3 2005/01/22 21:59:15 jjanke Exp $
echo Saving database reference@$ADEMPIERE_DB_NAME to $ADEMPIERE_HOME/data/Adempiere_pg.dmp
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
then
echo "Please make sure that the environment variables are set correctly:"
echo " ADEMPIERE_HOME e.g. /Adempiere"
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
exit 1
fi
export PGPASSWORD=reference
pg_dump --no-owner -U reference $ADEMPIERE_DB_NAME > $ADEMPIERE_HOME/data/Adempiere_pg.dmp
export PGPASSWORD=
cd $ADEMPIERE_HOME/data
jar cvfM Adempiere_pg.jar Adempiere_pg.dmp

View File

@ -36,7 +36,9 @@ createdb $ADEMPIERE_DB_NAME -E UNICODE -O $2 -U $2
echo -------------------------------------
echo Import Adempiere_pg.dmp
echo -------------------------------------
ADEMPIERE_ALTER_ROLE_SQL = "ALTER ROLE $2 SET search_path TO adempiere, sqjj, pg_catalog"
psql -d $ADEMPIERE_DB_NAME -U $2 -c "$ADEMPIERE_ALTER_ROLE_SQL"
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
export PGPASSWORD=
ADEMPIERE_ALTER_ROLE_SQL=
export PGPASSWORD=

View File

@ -0,0 +1,25 @@
# $Id: ImportAdempiere.sh,v 1.10 2005/12/20 07:12:17 jjanke Exp $
echo Adempiere Database Import $Revision: 1.10 $
echo Importing Adempiere DB from $ADEMPIERE_HOME/data/Adempiere_pg.dmp
if [ $# -le 2 ]
then
echo "Usage: $0 <systemAccount> <AdempiereID> <AdempierePWD> <PostgresPwd>"
echo "Example: $0 postgres adempiere adempiere postgresPwd"
exit 1
fi
if [ "$ADEMPIERE_HOME" = "" -o "$ADEMPIERE_DB_NAME" = "" ]
then
echo "Please make sure that the environment variables are set correctly:"
echo " ADEMPIERE_HOME e.g. /Adempiere"
echo " ADEMPIERE_DB_NAME e.g. adempiere.adempiere.org"
exit 1
fi
export PGPASSWORD=$3
echo -------------------------------------
echo Import Adempiere_pg.dmp
echo -------------------------------------
psql -d $ADEMPIERE_DB_NAME -U $2 -f 01_add_missing_translations.sql
export PGPASSWORD=