]> matita.cs.unibo.it Git - helm.git/blob - components/binaries/table_creator/sync_db.sh
- components: composed coercions mus be generated with current base uri
[helm.git] / components / binaries / table_creator / sync_db.sh
1 #!/bin/sh
2
3 # sync metadata from a source database (usually "mowgli") to a target one
4 # (usually "matita")
5 # Created:        Fri, 13 May 2005 13:50:16 +0200 zacchiro
6 # Last-Modified:  Fri, 13 May 2005 13:50:16 +0200 zacchiro
7
8 SOURCE_DB="mowgli"
9 TARGET_DB="matita"
10 MYSQL_FLAGS="-u helm -h localhost"
11
12 MYSQL="mysql $MYSQL_FLAGS -f"
13 MYSQLDUMP="mysqldump $MYSQL_FLAGS"
14 MYSQLRESTORE="mysqlrestore $MYSQL_FLAGS"
15 TABLES=`./table_creator list all`
16 DUMP="${SOURCE_DB}_dump.gz"
17
18 echo "Dumping source db $SOURCE_DB ..."
19 $MYSQLDUMP $SOURCE_DB $TABLES | gzip -c > $DUMP
20 echo "Destroying old tables in target db $TARGET_DB ..."
21 ./table_destructor table all | $MYSQL $TARGET_DB
22 echo "Creating table structure in target db $TARGET_DB ..."
23 echo "Filling target db $TARGET_DB ..."
24 zcat $DUMP | $MYSQL $TARGET_DB
25 ./table_creator index all | $MYSQL $TARGET_DB
26 rm $DUMP
27 echo "Done."
28