Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/scripts create_joist_database

Project highlights: Architectural Overview

joist
Discussion topic

Hide all messages in topic

All messages in topic

CVS update: joist/scripts create_joist_database

Author thom
Full name Thom Wood
Date 2000-11-13 13:41:38 PST
Message User: thom
  Date: 00/11/13 13:41:38

  Modified: scripts create_joist_database
  Log:
  added generic script list processing
  
  Revision Changes Path
  1.10 +28 -13 joist/scripts/create​_joist_database
  
  Index: create_joist_database
  ====================​====================​====================​=======
  RCS file: /cvs/joist/scripts/c​reate_joist_database​,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- create_joist_database 2000/11/07 23:49:56 1.9
  +++ create_joist_database 2000/11/13 21:41:38 1.10
  @@ -1,7 +1,7 @@
   #!/bin/sh
   # Creates the Joist database user, database, and schema.
   #
  -# $Id: create_joist_database,v 1.9 2000/11/07 23:49:56 thom Exp $
  +# $Id: create_joist_database,v 1.10 2000/11/13 21:41:38 thom Exp $
   
   function fatal_error ()
   {
  @@ -18,7 +18,8 @@
      TypeName=$1
   fi
   
  -JOIST_DIR="${SANDB​OX}/joist/sql/org/jo​ist"
  +# Location of the JOIST SQL scripts.
  +SCRIPT_DIR="${SAND​BOX}/joist/sql/org/j​oist"
   
   MYSQL_MYSQLDB="mysql -u root -p${DATABASE_ADMIN_PASSWORD} mysql"
   
  @@ -39,10 +40,10 @@
      echo
   
      echo "Setting up database user ${DATABASE_USER}"
  - ${MYSQL_MYSQLDB} < ${JOIST_DIR}/setup_user.sql
  + ${MYSQL_MYSQLDB} < ${SCRIPT_DIR}/setup_user.sql
   
      echo "Setting up database ${DATABASE_NAME}"
  - ${MYSQL_MYSQLDB} < ${JOIST_DIR}/setup_database.sql
  + ${MYSQL_MYSQLDB} < ${SCRIPT_DIR}/setup​_database.sql
   
      echo "Reloading grant tables"
      mysqladmin -u root -p${DATABASE_ADMIN_PASSWORD} reload
  @@ -52,17 +53,31 @@
   echo "Updating Joist database schema using ${TypeName} list"
   
   # The order in which the schema and table population scripts must be executed.
  -LOAD_ORDER="${JOIS​T_DIR}/${TypeName}.​LoadOrder.lst"
  +LOAD_ORDER="${SCRI​PT_DIR}/${TypeName}​.LoadOrder.lst"
   
  -# Run each SQL script, dying if the script doesn't exist.
  +# Run each script, dying if the script doesn't exist.
   if [ -f ${LOAD_ORDER} ]; then
  - for sql in `sed -e 's/#.*$//' ${LOAD_ORDER}`; do
  - if [ -f "${JOIST_DIR}/${sql}" ]; then
  - echo "Running ${JOIST_DIR}/${sql}"
  - ${MYSQL_CMD} ${DATABASE_NAME} < ${JOIST_DIR}/${sql}
  - else
  - fatal_error "SQL script ${JOIST_DIR}/${sql} does not exist"
  - fi
  + for file in `sed -e 's/#.*$//' ${LOAD_ORDER}`; do
  + tname=`echo $file | sed -e 's/^.*\.\([a-zA-Z]*\)$/\1/'`
  + case "$tname" in
  + sql) if [ -f "${SCRIPT_DIR}/${file}" ]; then
  + echo "Running sql script ${SCRIPT_DIR}/${file}"
  + ${MYSQL_CMD} ${DATABASE_NAME} < ${SCRIPT_DIR}/${file}
  + elif [ -f "${SANDBOX}/${file}" ]; then
  + echo "Running sql script ${SANDBOX}/${file}"
  + ${MYSQL_CMD} ${DATABASE_NAME} < ${SANDBOX}/${file}
  + else
  + echo "SQL script ${file} not found in ${SANDBOX} or ${SCRIPT_DIR}"
  + fi
  + ;;
  + pl) if [ -f "${SCRIPT_DIR}/${file}" ]; then
  + echo "Running perl script ${SCRIPT_DIR}/${file}"
  + perl ${SCRIPT_DIR}/${file}
  + else
  + echo "SQL script ${file} not found in ${SANDBOX} or ${SCRIPT_DIR}"
  + fi
  + ;;
  + esac
       done
   else
       fatal_error "Can't determine load order: ${LOAD_ORDER} does not exist"
Messages per page: