Commit 42c8c622d546905bceea517a22f00db51fd69dcd
1 parent
feca4c01
Exists in
master
and in
3 other branches
update database files
Showing
2 changed files
with
52 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,37 @@ |
1 | +#!/bin/bash | |
2 | + | |
3 | +myname=`basename $0 .sh` | |
4 | + | |
5 | +# Pour Mac OS recent (10.10, Yosemite), la syntaxe du SED est differente | |
6 | +# Il faut donc faire une copie de ce fichier et transformer les instructions sed a l'interieur | |
7 | +# Pour cela, il suffit d'executer ces 2 lignes : | |
8 | +# cp ce_script.sh ce_script_macosx.sh | |
9 | +# sed -e "s/ -i / -i '' /" -i '' ce_script_macosx.sh | |
10 | + | |
11 | +if [ ! -f ../../config/app.php ] ; then | |
12 | +echo "Vous devez executer ce script depuis le dossier database/update/" | |
13 | +exit 1 | |
14 | +fi | |
15 | + | |
16 | + | |
17 | +# Get login, pass, dbname, and hostname | |
18 | +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4) | |
19 | +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4) | |
20 | +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4) | |
21 | +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4) | |
22 | + | |
23 | + | |
24 | +#cp -p ./script_sql/db-update-2016-07-01-irap.sql ./script_sql/db-update-2016-07-01-irap-build.sql | |
25 | +cp -p ./script_sql/$myname.sql ./script_sql/$myname-build.sql | |
26 | + | |
27 | +# Execute sql update script | |
28 | +sed -e "s/database/$database/" -i ./script_sql/$myname-build.sql | |
29 | +mysql --user=$username --password=$password -h $host < ./script_sql/$myname-build.sql | |
30 | + | |
31 | +# Delete cakephp cache | |
32 | +sudo rm ../../tmp/cache/models/* | |
33 | +sudo rm ../../tmp/cache/persistent/* | |
34 | + | |
35 | +sudo chmod -R 777 ../../tmp | |
36 | +sudo chmod -R 777 ../../vendor | |
37 | +sudo chmod -R 777 ../../webroot | ... | ... |
... | ... | @@ -0,0 +1,15 @@ |
1 | +use database; | |
2 | + | |
3 | +drop table if exists materiels2; | |
4 | + | |
5 | +ALTER TABLE fichemetrologiques ENGINE = InnoDB; | |
6 | + | |
7 | +ALTER TABLE formules ENGINE = InnoDB; | |
8 | + | |
9 | +ALTER TABLE fournisseurs ENGINE = InnoDB; | |
10 | + | |
11 | +ALTER TABLE mesures ENGINE = InnoDB; | |
12 | + | |
13 | +ALTER TABLE unites ENGINE = InnoDB; | |
14 | + | |
15 | +ALTER TABLE variables ENGINE = InnoDB; | ... | ... |