[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/admin/upgrades/ -> 0_15_inc.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # Changes applied to 0.15 database to give us 0.16
  21  
  22      # --------------------------------------------------------
  23      # $Id: 0_15_inc.php,v 1.9.16.1 2007-10-13 22:35:05 giallu Exp $
  24      # --------------------------------------------------------
  25  ?>
  26  <?php
  27      require( dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR . 'db_table_names_inc.php' );
  28  
  29      $upgrades = array();
  30  
  31      $upgrades[] = new FunctionUpgrade(
  32              '0.15-1',
  33              'Add file type column to bug file table',
  34              'upgrade_0_15_1' );
  35  
  36  	function upgrade_0_15_1() {
  37          global $t_bug_file_table;
  38  
  39          if ( !db_field_exists( 'file_type', $t_bug_file_table ) ) {
  40              $query = "ALTER TABLE $t_bug_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize";
  41  
  42              $result = @db_query( $query );
  43  
  44              if ( false == $result ) {
  45                  return false;
  46              }
  47          }
  48  
  49          return true;
  50      }
  51  
  52      $upgrades[] = new FunctionUpgrade(
  53              '0.15-2',
  54              'Add file type column to project file table',
  55              'upgrade_0_15_2' );
  56  
  57  	function upgrade_0_15_2() {
  58          global $t_project_file_table;
  59  
  60          if ( !db_field_exists( 'file_type', $t_project_file_table ) ) {
  61              $query = "ALTER TABLE $t_project_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize";
  62  
  63              $result = @db_query( $query );
  64  
  65              if ( false == $result ) {
  66                  return false;
  67              }
  68          }
  69  
  70          return true;
  71      }
  72  
  73      $upgrades[] = new SQLUpgrade(
  74              '0.15-3',
  75              '',
  76              "ALTER TABLE $t_bug_table CHANGE os_build os_build VARCHAR(32) NOT NULL"
  77          );
  78  
  79      $upgrades[] = new SQLUpgrade(
  80              '0.15-4',
  81              '',
  82              "ALTER TABLE $t_bug_table CHANGE build build VARCHAR(32) NOT NULL"
  83          );
  84  
  85      $upgrades[] = new SQLUpgrade(
  86              '0.15-5',
  87              '',
  88              "ALTER TABLE $t_bug_table CHANGE votes votes INT(4) NOT NULL"
  89          );
  90  
  91      $upgrades[] = new SQLUpgrade(
  92              '0.15-6',
  93              '',
  94              "ALTER TABLE $t_user_profile_table CHANGE os_build os_build VARCHAR(32) NOT NULL"
  95          );
  96  
  97      $upgrades[] = new SQLUpgrade(
  98              '0.15-7',
  99              '',
 100              "ALTER TABLE $t_user_pref_table CHANGE language language VARCHAR(32) DEFAULT 'english' NOT NULL"
 101          );
 102  
 103      $upgrades[] = new SQLUpgrade(
 104              '0.15-8',
 105              'Create bug history table',
 106              "CREATE TABLE IF NOT EXISTS $t_bug_history_table (
 107                user_id int(7) unsigned zerofill NOT NULL default '0000000',
 108                bug_id int(7) unsigned zerofill NOT NULL default '0000000',
 109                date_modified datetime NOT NULL default '1970-01-01 00:00:01',
 110                field_name varchar(32) NOT NULL default '',
 111                old_value varchar(128) NOT NULL default '',
 112                new_value varchar(128) NOT NULL default '',
 113                KEY bug_id (bug_id),
 114                KEY user_id (user_id))"
 115          );
 116  
 117  
 118      $upgrades[] = new FunctionUpgrade(
 119              '0.15-9',
 120              'Add order field to project version table',
 121              'upgrade_0_15_9' );
 122  
 123  	function upgrade_0_15_9() {
 124          global $t_project_version_table;
 125  
 126          if ( !db_field_exists( 'date_order', $t_project_version_table ) ) {
 127              $query = "ALTER TABLE $t_project_version_table ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL";
 128  
 129              $result = @db_query( $query );
 130  
 131              if ( false == $result ) {
 132                  return false;
 133              }
 134          }
 135  
 136          return true;
 137      }
 138  
 139      return $upgrades;
 140  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics