From: <jl...@us...> - 2004-02-06 14:36:09
|
Update of /cvsroot/mantisbt/mantisbt/admin/upgrades In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14588/admin/upgrades Modified Files: 0_15_inc.php 0_16_inc.php Log Message: Fix #3449: Database upgrade script fails to detect some existing columns. Index: 0_15_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/admin/upgrades/0_15_inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** 0_15_inc.php 11 Jan 2004 07:16:09 -0000 1.4 --- 0_15_inc.php 6 Feb 2004 14:33:25 -0000 1.5 *************** *** 17,31 **** $upgrades = array(); ! $upgrades[] = new SQLUpgrade( '0.15-1', 'Add file type column to bug file table', ! "ALTER TABLE $t_bug_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize" ! ); ! $upgrades[] = new SQLUpgrade( '0.15-2', 'Add file type column to project file table', ! "ALTER TABLE $t_project_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize" ! ); $upgrades[] = new SQLUpgrade( --- 17,61 ---- $upgrades = array(); ! $upgrades[] = new FunctionUpgrade( '0.15-1', 'Add file type column to bug file table', ! 'upgrade_0_15_1' ); ! ! function upgrade_0_15_1() { ! global $t_bug_file_table; ! ! if ( !db_field_exists( 'file_type', $t_bug_file_table ) ) { ! $query = "ALTER TABLE $t_bug_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } ! $upgrades[] = new FunctionUpgrade( '0.15-2', 'Add file type column to project file table', ! 'upgrade_0_15_2' ); ! ! function upgrade_0_15_2() { ! global $t_project_file_table; ! ! if ( !db_field_exists( 'file_type', $t_project_file_table ) ) { ! $query = "ALTER TABLE $t_project_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } $upgrades[] = new SQLUpgrade( *************** *** 74,83 **** ! $upgrades[] = new SQLUpgrade( '0.15-9', 'Add order field to project version table', ! "ALTER TABLE $t_project_version_table ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL" ! ); ! return $upgrades; --- 104,127 ---- ! $upgrades[] = new FunctionUpgrade( '0.15-9', 'Add order field to project version table', ! 'upgrade_0_15_9' ); ! ! function upgrade_0_15_9() { ! global $t_project_version_table; ! ! if ( !db_field_exists( 'date_order', $t_project_version_table ) ) { ! $query = "ALTER TABLE $t_project_version_table ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } return $upgrades; Index: 0_16_inc.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/admin/upgrades/0_16_inc.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** 0_16_inc.php 11 Jan 2004 07:16:09 -0000 1.4 --- 0_16_inc.php 6 Feb 2004 14:33:25 -0000 1.5 *************** *** 55,70 **** ! $upgrades[] = new SQLUpgrade( '0.16-7', 'Add view_state to bug table', ! "ALTER TABLE $t_bug_table ADD view_state INT(2) DEFAULT '10' NOT NULL AFTER profile_id" ! ); ! $upgrades[] = new SQLUpgrade( '0.16-8', 'Add view_state to bugnote table', ! "ALTER TABLE $t_bugnote_table ADD view_state INT(2) DEFAULT '10' NOT NULL AFTER bugnote_text_id" ! ); ! $upgrades[] = new SQLUpgrade( --- 55,99 ---- ! $upgrades[] = new FunctionUpgrade( '0.16-7', 'Add view_state to bug table', ! 'upgrade_0_16_7' ); ! ! function upgrade_0_16_7() { ! global $t_bug_table; ! ! if ( !db_field_exists( 'view_state', $t_bug_table ) ) { ! $query = "ALTER TABLE $t_bug_table ADD view_state INT(2) DEFAULT '10' NOT NULL AFTER profile_id"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } ! $upgrades[] = new FunctionUpgrade( '0.16-8', 'Add view_state to bugnote table', ! 'upgrade_0_16_8' ); ! ! function upgrade_0_16_8() { ! global $t_bugnote_table; ! ! if ( !db_field_exists( 'view_state', $t_bugnote_table ) ) { ! $query = "ALTER TABLE $t_bugnote_table ADD view_state INT(2) DEFAULT '10' NOT NULL AFTER bugnote_text_id"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } $upgrades[] = new SQLUpgrade( *************** *** 92,100 **** ); ! $upgrades[] = new SQLUpgrade( '0.16-13', 'Add project_id to user pref table', ! "ALTER TABLE $t_user_pref_table ADD project_id INT(7) UNSIGNED ZEROFILL NOT NULL AFTER user_id" ! ); $upgrades[] = new SQLUpgrade( --- 121,144 ---- ); ! $upgrades[] = new FunctionUpgrade( '0.16-13', 'Add project_id to user pref table', ! 'upgrade_0_16_13' ); ! ! function upgrade_0_16_13() { ! global $t_user_pref_table; ! ! if ( !db_field_exists( 'project_id', $t_user_pref_table ) ) { ! $query = "ALTER TABLE $t_user_pref_table ADD project_id INT(7) UNSIGNED ZEROFILL NOT NULL AFTER user_id"; ! ! $result = @db_query( $query ); ! ! if ( false == $result ) { ! return false; ! } ! } ! ! return true; ! } $upgrades[] = new SQLUpgrade( |