Blame view

install/manual_install/install-DB.sh 1.66 KB
6c4edfa3   Alexandre   First Commit LabI...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Script de création et de mise à jour de la BD

source ./config.sh

#**************************************************************************

cd ../

# DB CREATION

#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST -e "DROP DATABASE $DBNAME;"
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST -e "CREATE DATABASE $DBNAME;"

f=tmp.sql
bdschema=database/BDD_IRAP.sql

cp $bdschema $f
sed -e "s/mydb/$DBNAME/g" $f > t ; mv t $f
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST $DBNAME < ./database/BDD_IRAP.sql
echo
echo "started CREATING DB $DBNAME from $bdschema file"
mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST < $f
echo "finished"
echo
rm -f $f

# Pause ?
#echo "Taper une touche pour continuer"
#echo
#read value


# DB UPDATE (appliquer les modifs faites sur la BD, dans l'ordre CHRONOLOGIQUE, s'il y en a...)

for f in database/update/db-update-*.sql ; do
	echo "started updating DB from $f file"
	mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST $DBNAME < $f
	echo "finished"
	echo
done

#mysql -u root --password='' -h localhost inventirap_test < database/update/db-update-2012-11-10.sql
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST $DBNAME < database/update/db-update-2012-11-10.sql
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST $DBNAME < database/update/db-update-2012-11-12.sql

#cp database/db_update.sql $f
# sed -e "s/mydb/$DBNAME/" $f > t ; mv t $f
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST $DBNAME < $f
#rm -f $f

#Ajouter Super Administrateur
#mysql -u $DBUSERNAME --password=$DBUSERPASS -h $DBHOST -D $DBNAME -e "INSERT INTO utilisateurs (nom, role) VALUES ('$SUPERADMINNAME', 'Super Administrateur');"