# 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');"