upgrade.base.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /*******************************************/
  3. /** Fichier de migration de la base MYSQL **/
  4. /*******************************************/
  5. require_once(__DIR__.DIRECTORY_SEPARATOR.'common.php');
  6. global $myUser;
  7. try{
  8. if(!$myUser->superadmin) throw new Exception('Merci de vous identifier en super admin');
  9. // [ MODIFICATIONS DU 18/03/2019 12:07 par JNARBONI]
  10. $comment = "Création de la table activedirectory_group";
  11. $query = "CREATE TABLE `activedirectory_group` (
  12. `id` int(11) NOT NULL AUTO_INCREMENT,
  13. `rank` varchar(225) DEFAULT NULL,
  14. `firm` int(11) DEFAULT NULL,
  15. `created` int(11) DEFAULT NULL,
  16. `updated` int(11) DEFAULT NULL,
  17. `updater` varchar(225) DEFAULT NULL,
  18. `creator` varchar(225) DEFAULT NULL
  19. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
  20. execute($comment,$query);
  21. $comment = "Création de la table dashboard_dashboard";
  22. $query = "CREATE TABLE `dashboard_dashboard` (
  23. `id` int(11) NOT NULL AUTO_INCREMENT,
  24. `user` varchar(225) DEFAULT NULL,
  25. `label` varchar(225) DEFAULT NULL,
  26. `icon` varchar(225) DEFAULT NULL,
  27. `default` tinyint(1) NOT NULL DEFAULT '0',
  28. `created` int(11) DEFAULT NULL,
  29. `updated` int(11) DEFAULT NULL,
  30. `updater` varchar(225) DEFAULT NULL,
  31. `creator` varchar(225) DEFAULT NULL
  32. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
  33. execute($comment,$query);
  34. $comment = "Création de la table dashboard_dashboard_widget";
  35. $query = "CREATE TABLE `dashboard_dashboard_widget` (
  36. `id` int(11) NOT NULL AUTO_INCREMENT,
  37. `model` varchar(225) DEFAULT NULL,
  38. `position` int(11) DEFAULT NULL,
  39. `minified` tinyint(1) NOT NULL DEFAULT '0',
  40. `dashboard` int(11) DEFAULT NULL,
  41. `created` int(11) DEFAULT NULL,
  42. `updated` int(11) DEFAULT NULL,
  43. `updater` varchar(225) DEFAULT NULL,
  44. `creator` varchar(225) DEFAULT NULL
  45. ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
  46. execute($comment,$query);
  47. $comment = "Ajout de la colonne mail (varchar(225)) sur la table firm";
  48. $query = "ALTER TABLE `firm` ADD COLUMN `mail` varchar(225) NOT NULL;";
  49. execute($comment,$query);
  50. $comment = "Ajout de la colonne assign (varchar(225)) sur la table issue_report";
  51. $query = "ALTER TABLE `issue_report` ADD COLUMN `assign` varchar(225) DEFAULT NULL;";
  52. execute($comment,$query);
  53. $comment = "Ajout de la colonne state (varchar(225)) sur la table issue_report";
  54. $query = "ALTER TABLE `issue_report` ADD COLUMN `state` varchar(225) DEFAULT NULL;";
  55. execute($comment,$query);
  56. $comment = "Ajout de la colonne passwordTime (varchar(225)) sur la table user";
  57. $query = "ALTER TABLE `user` ADD COLUMN `passwordTime` varchar(225) DEFAULT NULL;";
  58. execute($comment,$query);
  59. //--INSTRUCTIONS
  60. function execute($comment,$sql){
  61. echo $comment.'<br/>';
  62. User::staticQuery($sql);
  63. echo '</hr>';
  64. }
  65. }catch(Exception $e){ ?>
  66. <div style="text-align: center;margin:auto;width:500px;">
  67. Erreur : <?php echo $e->getMessage(); ?>
  68. </div>
  69. <?php } ?>