Commit 42c8c622d546905bceea517a22f00db51fd69dcd

Authored by Etienne Pallier
1 parent feca4c01

update database files

database/update/db-update-2017-08-23.sh 0 → 100755
... ... @@ -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
... ...
database/update/script_sql/db-update-2017-08-23.sql 0 → 100644
... ... @@ -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;
... ...