/[gnue-sb]/gnue-sb/utils/build-schema-import.sh
ViewVC logotype

Diff of /gnue-sb/utils/build-schema-import.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by jcater, Sat Jun 28 06:05:28 2003 UTC revision 1.2 by Vee2d2, Tue Jul 15 12:19:15 2003 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2    #
3    # Run me from the root of the gnue-sb cvs tree to generate
4    # schema libraries in each of the module directories
5    # and a master schema library in schema/
6    # you can then use gnue-schema to create SQL files from the gsd files
7    # eg: gnue-schema schema/schema.gsd will create SQL files to populate
8    # the db of your choosing. see gnue-schema --help for more info.
9    
10  echo "Creating a module-level schema.gsd file using *.gsd"  
11    BASE=${PWD}
12    MS="${BASE}/schema/schema.gsd"
13    echo "Master schema will be located at ${MS}"
14    echo "Creating a master schema.gsd file from the *.gsd located in each of the module's schema dirs"
15  (echo "<?xml version=\"1.0\"?>  (echo "<?xml version=\"1.0\"?>
16    <!-- This file was created automagically using the build-schema-import.sh
17          script located in gnue-sb's utils directory -->
18    <schema>
19     <tables>")>${MS}
20    
21    echo "Seeking out schema dirs in the tree.."
22    for d in `find . -type d |grep schema |grep -v CVS|grep -v ^./schema`
23    do
24    #  if [ $d != "./schema" ]; then
25        echo "hoping into $d..."
26        cd $d
27        echo "Creating a module-level schema.gsd file using *.gsd"
28        (echo "<?xml version=\"1.0\"?>
29    <!-- This file was created automagically using the build-schema-import.sh
30          script located in gnue-sb's utils directory -->
31  <schema>  <schema>
32   <tables>   <tables>")>schema.gsd
33  "      for f in `ls *.gsd|grep -v schema.gsd`
34  for f in `ls *.gsd|grep -v schema.gsd`      do
35  do        echo "  <import-table library=\"$f\" name=\"`basename $f .gsd`\"/>">>schema.gsd
36    echo "  <import-table library=\"$f\" name=\"`basename $f .gsd`\"/>"        echo "  <import-table library=\".$d/$f\" name=\"`basename $f .gsd`\"/>">>${MS}
37  done      done
38  echo " </tables>      (echo " </tables>
39    </schema>
40        ") >> schema.gsd
41        cd ${BASE}
42    #  fi
43      done
44    (echo " </tables>
45  </schema>  </schema>
46  ") > schema.gsd  ")>>${MS}
47      

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26