From c425fb36f985e4cf1358f75cf16118f9f11fe773 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 26 Feb 2007 05:56:03 +0000 Subject: [PATCH] Upload script contributed by northernbrewer https://sourceforge.net/forum/message.php?msg_id=4177843 --- migration/migrate.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 migration/migrate.sh diff --git a/migration/migrate.sh b/migration/migrate.sh new file mode 100644 index 0000000000..36e9feea7f --- /dev/null +++ b/migration/migrate.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# This formats all the SQL files in the specified directory so that +# they can be executed by SQL*Plus. There are two modes -- a 'testing' +# mode (the default mode -- this stips out all the "commit" statements) +# and a commit mode for deployment. You need to pipe the output of this +# script into sqlplus, for example: +# ./migrate.sh 313-314 commit | sqlplus compiere/compiere + +# Contributed by Chris Farley - northernbrewer + +if [ -z "$1" ]; then + echo "Usage: migrate DIRECTORY [commit]" + exit 0 +fi +echo "SET SQLBLANKLINES ON;" +echo "SET DEFINE OFF;" +for file in `ls $1`; do + echo "SELECT '$file' AS Filename FROM dual;" + cat $1/$file | sed 's/commit[ ]*;//I' + echo +done +if [ "$2" = "commit" ]; then + echo "COMMIT;" +else + echo "ROLLBACK;" +fi