10 TABLE_CREATOR="../../ocaml/metadata/table_creator/table_creator"
13 STDLIB_DATA="matita_stdlib.sql.gz"
15 grant_sql="GRANT ALL PRIVILEGES ON $DBNAME.* TO $DBUSER@$DBHOST"
16 create_sql="CREATE DATABASE $DBNAME"
17 drop_sql="DROP DATABASE $DBNAME"
25 echo " Dropping old databases, if any."
26 echo " You can ignore errors output by this step"
27 echo "$drop_sql" | $MYSQL -f
29 echo " Creating database and users."
30 echo "# SQL statements to create Matita DB and users" > $SQL
31 appendsql "$create_sql;"
32 if [ -z "$DBPASS" ]; then
33 appendsql "$grant_sql;"
35 appendsql "$grant_sql IDENTIFIED BY '$DBPASS';"
39 echo " Creating database structure."
40 echo "# SQL statements to create Matita DB structure" > $SQL
41 creator_args="table fill index"
42 for arg in $creator_args; do
43 appendsql "`$TABLE_CREATOR $arg all`"
47 echo " Filling database with standard library metadata."
48 if [ -f "$STDLIB_DATA" ]; then
49 gunzip -c "$STDLIB_DATA" | $MYSQL $DBNAME
51 echo " Standard library metadata file $STDLIB_DATA not found, skipping this step."