[ 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_16_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.16 database to give us 0.17
  21  
  22      # --------------------------------------------------------
  23      # $Id: 0_16_inc.php,v 1.9.16.1 2007-10-13 22:35:07 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 SQLUpgrade(
  32              '0.16-1',
  33              '',
  34              "ALTER TABLE $t_bug_table CHANGE last_updated last_updated DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL"
  35          );
  36  
  37      $upgrades[] = new SQLUpgrade(
  38              '0.16-2',
  39              '',
  40              "ALTER TABLE $t_bugnote_table CHANGE last_modified last_modified DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL"
  41          );
  42  
  43      $upgrades[] = new SQLUpgrade(
  44              '0.16-3',
  45              '',
  46              "ALTER TABLE $t_news_table CHANGE last_modified last_modified DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL"
  47          );
  48  
  49      $upgrades[] = new SQLUpgrade(
  50              '0.16-4',
  51              '',
  52              "ALTER TABLE $t_user_table CHANGE last_visit last_visit DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL"
  53          );
  54  
  55  
  56      $upgrades[] = new SQLUpgrade(
  57              '0.16-5',
  58              '',
  59              "ALTER TABLE $t_bug_file_table CHANGE content content LONGBLOB NOT NULL"
  60          );
  61  
  62      $upgrades[] = new SQLUpgrade(
  63              '0.16-6',
  64              '',
  65              "ALTER TABLE $t_project_file_table CHANGE content content LONGBLOB NOT NULL"
  66          );
  67  
  68  
  69      $upgrades[] = new FunctionUpgrade(
  70              '0.16-7',
  71              'Add view_state to bug table',
  72              'upgrade_0_16_7' );
  73  
  74  	function upgrade_0_16_7() {
  75          global $t_bug_table;
  76  
  77          if ( !db_field_exists( 'view_state', $t_bug_table ) ) {
  78              $query = "ALTER TABLE $t_bug_table ADD view_state INT(2) DEFAULT '10'  NOT NULL AFTER profile_id";
  79  
  80              $result = @db_query( $query );
  81  
  82              if ( false == $result ) {
  83                  return false;
  84              }
  85          }
  86  
  87          return true;
  88      }
  89  
  90      $upgrades[] = new FunctionUpgrade(
  91              '0.16-8',
  92              'Add view_state to bugnote table',
  93              'upgrade_0_16_8' );
  94  
  95  	function upgrade_0_16_8() {
  96          global $t_bugnote_table;
  97  
  98          if ( !db_field_exists( 'view_state', $t_bugnote_table ) ) {
  99              $query = "ALTER TABLE $t_bugnote_table ADD view_state INT(2) DEFAULT '10' NOT NULL AFTER bugnote_text_id";
 100  
 101              $result = @db_query( $query );
 102  
 103              if ( false == $result ) {
 104                  return false;
 105              }
 106          }
 107  
 108          return true;
 109      }
 110  
 111      $upgrades[] = new SQLUpgrade(
 112              '0.16-9',
 113              '',
 114              "ALTER TABLE $t_project_version_table CHANGE version version VARCHAR(64) NOT NULL"
 115          );
 116  
 117      $upgrades[] = new SQLUpgrade(
 118              '0.16-10',
 119              '',
 120              "ALTER TABLE $t_project_category_table CHANGE category category VARCHAR(64) NOT NULL"
 121          );
 122  
 123      $upgrades[] = new SQLUpgrade(
 124              '0.16-11',
 125              '',
 126              "ALTER TABLE $t_bug_table CHANGE category category VARCHAR(64) NOT NULL"
 127          );
 128  
 129      $upgrades[] = new SQLUpgrade(
 130              '0.16-12',
 131              '',
 132              "ALTER TABLE $t_bug_table CHANGE version version VARCHAR(64) NOT NULL"
 133          );
 134  
 135      $upgrades[] = new FunctionUpgrade(
 136              '0.16-13',
 137              'Add project_id to user pref table',
 138              'upgrade_0_16_13' );
 139  
 140  	function upgrade_0_16_13() {
 141          global $t_user_pref_table;
 142  
 143          if ( !db_field_exists( 'project_id', $t_user_pref_table ) ) {
 144              $query = "ALTER TABLE $t_user_pref_table ADD project_id INT(7) UNSIGNED ZEROFILL NOT NULL AFTER user_id";
 145  
 146              $result = @db_query( $query );
 147  
 148              if ( false == $result ) {
 149                  return false;
 150              }
 151          }
 152  
 153          return true;
 154      }
 155  
 156      $upgrades[] = new SQLUpgrade(
 157              '0.16-14',
 158              'Create bug relationship table',
 159              "CREATE TABLE IF NOT EXISTS $t_bug_relationship_table (
 160                source_bug_id int(7) unsigned zerofill NOT NULL default '0000000',
 161                destination_bug_id int(7) unsigned zerofill NOT NULL default '0000000',
 162                relationship_type int(2) NOT NULL default '0')"
 163          );
 164  
 165      $upgrades[] = new SQLUpgrade(
 166              '0.16-15',
 167              'Create bug monitor table',
 168              "CREATE TABLE IF NOT EXISTS $t_bug_monitor_table (
 169                user_id int(7) unsigned zerofill NOT NULL default '0000000',
 170                bug_id int(7) unsigned NOT NULL default '0')"
 171          );
 172  
 173      return $upgrades;
 174  ?>


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