Commit fe6721579bbad1b6e58e4f8897c579c58f24be61

Authored by Alexandre
1 parent 73c4199c

bugfixes 2

database/update/db-update-2016-06-27-irap.sh 0 → 100755
... ... @@ -0,0 +1,34 @@
  1 +#!/bin/bash
  2 +
  3 +# Pour Mac OS recent (10.10, Yosemite), la syntaxe du SED est differente
  4 +# Il faut donc faire une copie de ce fichier et transformer les instructions sed a l'interieur
  5 +# Pour cela, il suffit d'executer ces 2 lignes :
  6 +# cp ce_script.sh ce_script_macosx.sh
  7 +# sed -e "s/ -i / -i '' /" -i '' ce_script_macosx.sh
  8 +
  9 +if [ ! -f ../../config/app.php ] ; then
  10 +echo "Vous devez executer ce script depuis le dossier database/update/"
  11 +exit 1
  12 +fi
  13 +
  14 +
  15 +# Get login, pass, dbname, and hostname
  16 +username=$(grep "/\*d\*/'username'" ../../config/app.php | cut -d"'" -f4)
  17 +password=$(grep "/\*d\*/'password'" ../../config/app.php | cut -d"'" -f4)
  18 +database=$(grep "/\*d\*/'database'" ../../config/app.php | cut -d"'" -f4)
  19 +host=$(grep "/\*d\*/'host'" ../../config/app.php | cut -d"'" -f4)
  20 +
  21 +
  22 +cp -p ./script_sql/db-update-2016-06-27-irap.sql ./script_sql/db-update-2016-06-27-irap-build.sql
  23 +
  24 +# Execute sql update script
  25 +sed -e "s/database/$database/" -i ./script_sql/db-update-2016-06-27-irap-build.sql
  26 +mysql --user=$username --password=$password -h $host < ./script_sql/db-update-2016-06-27-irap-build.sql
  27 +
  28 +# Delete cakephp cache
  29 +sudo rm ../../tmp/cache/models/*
  30 +sudo rm ../../tmp/cache/persistent/*
  31 +
  32 +sudo chmod -R 777 ../../tmp
  33 +sudo chmod -R 777 ../../vendor
  34 +sudo chmod -R 777 ../../webroot
... ...
database/update/script_sql/db-update-2016-06-27-irap.sql 0 → 100755
... ... @@ -0,0 +1,4 @@
  1 +use database;
  2 +
  3 +ALTER TABLE `documents` ADD CONSTRAINT `fk_documents_type_documents_id` FOREIGN KEY (`type_document_id`) REFERENCES `type_documents` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
  4 +
... ...
database/update/script_sql/db-update-pb-irap.sql
... ... @@ -5,4 +5,4 @@ update materiels set numero_laboratoire =&quot;IRAP-2016-0022&quot; where numero_laboratoi
5 5 update materiels set numero_laboratoire ="IRAP-2016-0023" where numero_laboratoire ="IRAP-16-0003";
6 6 update materiels set numero_laboratoire ="IRAP-2016-0024" where numero_laboratoire ="IRAP-16-0004";
7 7 update materiels set numero_laboratoire ="IRAP-2016-0025" where numero_laboratoire ="IRAP-16-0005";
8   -
  8 +update materiels set numero_laboratoire ="IRAP-2015-0131" where numero_laboratoire ="IRAP-15-0001";
... ...