Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/sql/org/joist joist.sql

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/sql/org/joist joist.sql

Author thom
Full name Thom Wood
Date 2000-11-07 15:49:56 PST
Message User: thom
  Date: 00/11/07 15:49:56

  Modified: scripts create_joist_database
  Removed: sql/org/joist joist.sql
  Log:
  change create_joist_database to allow different types of installs
  
  Revision Changes Path
  1.9 +65 -20 joist/scripts/create​_joist_database
  
  Index: create_joist_database
  ====================​====================​====================​=======
  RCS file: /cvs/joist/scripts/c​reate_joist_database​,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- create_joist_database 2000/11/01 20:13:18 1.8
  +++ create_joist_database 2000/11/07 23:49:56 1.9
  @@ -1,32 +1,77 @@
   #!/bin/sh
   # Creates the Joist database user, database, and schema.
   #
  -# $Id: create_joist_database,v 1.8 2000/11/01 20:13:18 dlr Exp $
  +# $Id: create_joist_database,v 1.9 2000/11/07 23:49:56 thom Exp $
   
  -SQL_DIR="${SANDBOX​}/joist/sql/org/jois​t"
  +function fatal_error ()
  +{
  + echo "${0}: ${1}"
  + exit 1
  +}
  +
  +# Type of create (used to select load list)
  +# and if eq "INSTALL" load the users
  +TypeName=INSTALL
  +
  +# The type name
  +if [ $# -gt 0 ] ; then
  + TypeName=$1
  +fi
  +
  +JOIST_DIR="${SANDB​OX}/joist/sql/org/jo​ist"
  +
   MYSQL_MYSQLDB="mysql -u root -p${DATABASE_ADMIN_PASSWORD} mysql"
  -MYSQL_APPDB="mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD} ${DATABASE_NAME}"
  +
  +MYSQL_CMD="mysql -u${DATABASE_USER} -p${DATABASE_PASSWORD}"
  +
  +
  +if [ "$TypeName" = "INSTALL" ] ; then
  + # Give the user some info.
  + echo -n 'You will be prompted to enter a password several times during the '
  + echo 'execution of '
  + echo 'this script.'
  + if [ -z "${DATABASE_ADMIN_PASSWORD}" ]; then
  + echo 'Please use the root MySQL password.'
  + else
  + echo -n 'Using the root MySQL password from the DATABASE_ADMIN_PASSWORD '
  + echo 'env var.'
  + fi
  + echo
  +
  + echo "Setting up database user ${DATABASE_USER}"
  + ${MYSQL_MYSQLDB} < ${JOIST_DIR}/setup_user.sql
  +
  + echo "Setting up database ${DATABASE_NAME}"
  + ${MYSQL_MYSQLDB} < ${JOIST_DIR}/setup_database.sql
   
  -# Give the user some info.
  -echo -n 'You will be prompted to enter a password several times during the '
  -echo 'execution of '
  -echo 'this script.'
  -if [ -z "${DATABASE_ADMIN_PASSWORD}" ]; then
  - echo 'Please use the root MySQL password.'
  + echo "Reloading grant tables"
  + mysqladmin -u root -p${DATABASE_ADMIN_PASSWORD} reload
  +fi
  +
  +# Run the necessary SQL scripts to update to the Joist schema.
  +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"
  +
  +# Run each SQL 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
  + done
   else
  - echo -n 'Using the root MySQL password from the DATABASE_ADMIN_PASSWORD '
  - echo 'env var.'
  + fatal_error "Can't determine load order: ${LOAD_ORDER} does not exist"
   fi
  -echo
  +
  +exit 0
  +
  +
   
  -echo "Setting up database user ${DATABASE_USER}"
  -${MYSQL_MYSQLDB} < ${SQL_DIR}/setup_user.sql
   
  -echo "Setting up database ${DATABASE_NAME}"
  -${MYSQL_MYSQLDB} < ${SQL_DIR}/setup_database.sql
   
  -echo "Reloading grant tables"
  -mysqladmin -u root -p${DATABASE_ADMIN_PASSWORD} reload
   
  -echo 'Creating Joist database schema'
  -${MYSQL_APPDB} < ${SQL_DIR}/joist.sql

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/sql/org/joist joist.sql thom Thom Wood 2000-11-07 15:49:56 PST
Messages per page: