IDEMPIERE-3655 Improve installer to include migration scripts and syncApplied / add optional folder parameter to process out of migration

This commit is contained in:
Carlos Ruiz 2018-11-09 21:33:47 -02:00
parent dd530a71f4
commit 679cffb72d
3 changed files with 31 additions and 7 deletions

View File

@ -7,4 +7,4 @@ fi
. ./myEnvironment.sh Server
echo Synchronize iDempiere Database - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\)
sh $ADEMPIERE_DB_PATH/SyncDB.sh "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_PATH"
sh $ADEMPIERE_DB_PATH/SyncDB.sh "$ADEMPIERE_DB_USER" "$ADEMPIERE_DB_PASSWORD" "$ADEMPIERE_DB_PATH" $*

View File

@ -30,8 +30,20 @@ ADEMPIERE_DB_PATH=$3
CMD="sqlplus $ADEMPIERE_DB_USER/$ADEMPIERE_DB_PASSWORD@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME"
SILENTCMD="sqlplus -S $ADEMPIERE_DB_USER/$ADEMPIERE_DB_PASSWORD@$ADEMPIERE_DB_SERVER:$ADEMPIERE_DB_PORT/$ADEMPIERE_DB_NAME"
ERROR_STRINGS="^(ORA-[0-9]+:|TNS-|PLS-)"
DIR_POST=$IDEMPIERE_HOME/migration
if [ "x$4" = "x" ]
then
DIR_SCRIPTS=$IDEMPIERE_HOME/migration
else
if [ `expr substr "$4" 1 1` = "/" ]
then
DIR_SCRIPTS="$4"
else
DIR_SCRIPTS="$IDEMPIERE_HOME/$4"
fi
fi
cd $IDEMPIERE_HOME/migration
cd "$DIR_SCRIPTS"
# Create list of files already applied - registered in AD_MigrationScript table
echo "set heading off
@ -47,7 +59,7 @@ find -type d -name $ADEMPIERE_DB_PATH | grep -v "./processes_post_migration/$ADE
do
cd "${FOLDER}"
ls *.sql 2>/dev/null >> $TMPFOLDER/lisFS_$$.txt
cd $IDEMPIERE_HOME/migration
cd "$DIR_SCRIPTS"
done
sort -o $TMPFOLDER/lisFS_$$.txt $TMPFOLDER/lisFS_$$.txt
sort -o $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisDB_$$.txt
@ -82,7 +94,7 @@ else
fi
if [ x$APPLIED = xY ]
then
cd $IDEMPIERE_HOME/migration
cd "$DIR_POST"
for FILE in processes_post_migration/$ADEMPIERE_DB_PATH/*.sql
do
OUTFILE=$TMPFOLDER/SyncDB_out_$$/`basename "$FILE" .sql`.out

View File

@ -32,8 +32,20 @@ ADEMPIERE_DB_PATH=$3
CMD="psql -h $ADEMPIERE_DB_SERVER -p $ADEMPIERE_DB_PORT -d $ADEMPIERE_DB_NAME -U $ADEMPIERE_DB_USER"
SILENTCMD="$CMD -q -t"
ERROR_STRINGS="^(ERROR:|FEHLER:|FATAL:|ERRO:)"
DIR_POST=$IDEMPIERE_HOME/migration
if [ "x$4" = "x" ]
then
DIR_SCRIPTS=$IDEMPIERE_HOME/migration
else
if [ `expr substr "$4" 1 1` = "/" ]
then
DIR_SCRIPTS="$4"
else
DIR_SCRIPTS="$IDEMPIERE_HOME/$4"
fi
fi
cd $IDEMPIERE_HOME/migration
cd "$DIR_SCRIPTS"
# Create list of files already applied - registered in AD_MigrationScript table
echo "select name from ad_migrationscript" | $SILENTCMD | sed -e 's:^ ::' | grep -v '^$' | sort > $TMPFOLDER/lisDB_$$.txt
@ -44,7 +56,7 @@ find -type d -name $ADEMPIERE_DB_PATH | grep -v "./processes_post_migration/$ADE
do
cd "${FOLDER}"
ls *.sql 2>/dev/null >> $TMPFOLDER/lisFS_$$.txt
cd $IDEMPIERE_HOME/migration
cd "$DIR_SCRIPTS"
done
sort -o $TMPFOLDER/lisFS_$$.txt $TMPFOLDER/lisFS_$$.txt
sort -o $TMPFOLDER/lisDB_$$.txt $TMPFOLDER/lisDB_$$.txt
@ -79,7 +91,7 @@ else
fi
if [ x$APPLIED = xY ]
then
cd $IDEMPIERE_HOME/migration
cd "$DIR_POST"
for FILE in processes_post_migration/$ADEMPIERE_DB_PATH/*.sql
do
OUTFILE=$TMPFOLDER/SyncDB_out_$$/`basename "$FILE" .sql`.out