📄 0_17_inc.php
字号:
MODIFY id int(7) unsigned NOT NULL auto_increment" ); $upgrades[] = new SQLUpgrade( '0.17-jf-35', 'Remove zerofill on mantis_news_table.project_id', "ALTER TABLE $t_news_table MODIFY project_id int(7) unsigned NOT NULL default 0" ); $upgrades[] = new SQLUpgrade( '0.17-jf-36', 'Remove zerofill on mantis_news_table.poster_id', "ALTER TABLE $t_news_table MODIFY poster_id int(7) unsigned zerofill NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-37', 'Remove zerofill on mantis_project_category_table.project_id', "ALTER TABLE $t_project_category_table MODIFY project_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-38', 'Remove zerofill on mantis_project_file_table.id', "ALTER TABLE $t_project_file_table MODIFY id int(7) unsigned NOT NULL auto_increment" ); $upgrades[] = new SQLUpgrade( '0.17-jf-39', 'Remove zerofill on mantis_project_file_table.project_id', "ALTER TABLE $t_project_file_table MODIFY project_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-40', 'Remove zerofill on mantis_project_table.id', "ALTER TABLE $t_project_table MODIFY id int(7) unsigned NOT NULL auto_increment" ); $upgrades[] = new SQLUpgrade( '0.17-jf-41', 'Remove zerofill on mantis_project_user_list_table.project_id', "ALTER TABLE $t_project_user_list_table MODIFY project_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-42', 'Remove zerofill on mantis_project_user_list_table.user_id', "ALTER TABLE $t_project_user_list_table MODIFY user_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-43', 'Remove zerofill on mantis_project_version_table.project_id', "ALTER TABLE $t_project_version_table MODIFY project_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-44', 'Remove zerofill on mantis_user_pref_table.id', "ALTER TABLE $t_user_pref_table MODIFY id int(7) unsigned NOT NULL auto_increment" ); $upgrades[] = new SQLUpgrade( '0.17-jf-45', 'Remove zerofill on mantis_user_pref_table.user_id', "ALTER TABLE $t_user_pref_table MODIFY user_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-46', 'Remove zerofill on mantis_user_pref_table.project_id', "ALTER TABLE $t_user_pref_table MODIFY project_id int(7) unsigned NOT NULL default 0" ); $upgrades[] = new SQLUpgrade( '0.17-jf-47', 'Remove zerofill on mantis_user_pref_table.default_profile', "ALTER TABLE $t_user_pref_table MODIFY default_profile int(7) unsigned NOT NULL default 0" ); $upgrades[] = new SQLUpgrade( '0.17-jf-48', 'Remove zerofill on mantis_user_pref_table.default_project', "ALTER TABLE $t_user_pref_table MODIFY default_project int(7) unsigned NOT NULL default 0" ); $upgrades[] = new SQLUpgrade( '0.17-jf-49', 'Remove zerofill on mantis_user_print_pref_table.user_id', "ALTER TABLE $t_user_print_pref_table MODIFY user_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-50', 'Remove zerofill on mantis_user_profile_table.id', "ALTER TABLE $t_user_profile_table MODIFY id int(7) unsigned NOT NULL auto_increment" ); $upgrades[] = new SQLUpgrade( '0.17-jf-51', 'Remove zerofill on mantis_user_profile_table.user_id', "ALTER TABLE $t_user_profile_table MODIFY user_id int(7) unsigned NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-jf-52', 'Remove zerofill on mantis_user_table.id', "ALTER TABLE $t_user_table MODIFY id int(7) unsigned NOT NULL auto_increment" ); # The following are all changes that were goofed somewhere between 0.13 and here # In some cases, changes were made in db_upgrade scripts but not applied to the # database that was used to generate db_generate. These upgrades all attempt to # make sure that all users end up with identical databases from this point on, # no matter what version they originally installed. $upgrades[] = new SQLUpgrade( '0.17-compat-1', 'Set default for mantis_bug_file_table.date_added (incorrect for 0.15 installs)', "ALTER TABLE $t_bug_file_table MODIFY date_added datetime DEFAULT '1970-01-01 00:00:01' NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-compat-2', 'Correct values for mantis_bug_file_table.date_added (incorrect for 0.15 installs)', "UPDATE $t_bug_file_table SET date_added='1970-01-01 00:00:01' WHERE date_added='0000-00-00 00:00:00'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-3', 'Set default for mantis_project_file_table.date_added (incorrect for 0.15 installs)', "ALTER TABLE $t_project_file_table MODIFY date_added datetime DEFAULT '1970-01-01 00:00:01' NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-compat-4', 'Correct values for mantis_project_file_table.date_added (incorrect for 0.15 installs)', "UPDATE $t_project_file_table SET date_added='1970-01-01 00:00:01' WHERE date_added='0000-00-00 00:00:00'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-5', 'Set default for mantis_bug_table.build (incorrect for 0.16 installs)', "ALTER TABLE $t_bug_table MODIFY build varchar(32) DEFAULT '' NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-compat-6', 'Correct values for mantis_bug_table.build (incorrect for 0.16 installs)', "UPDATE $t_bug_table SET build='' WHERE build='0'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-7', 'Set default for mantis_user_table.date_created (incorrect for < 0.17 installs)', "ALTER TABLE $t_user_table MODIFY date_created datetime DEFAULT '1970-01-01 00:00:01' NOT NULL" ); $upgrades[] = new SQLUpgrade( '0.17-compat-8', 'Correct values for mantis_user_table.date_created (incorrect for < 0.17 installs)', "UPDATE $t_user_table SET date_created='1970-01-01 00:00:01' WHERE date_created='0000-00-00 00:00:00'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-9', 'Set default for mantis_project_table.enabled to 1 (incorrect for < 0.17 installs)', "ALTER TABLE $t_project_table MODIFY enabled INT(1) NOT NULL DEFAULT '1'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-10', 'Set default for mantis_news_table.date_posted (incorrect for < 0.17 installs)', "ALTER TABLE $t_news_table MODIFY date_posted datetime NOT NULL DEFAULT '1970-01-01 00:00:01'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-11', 'Correct values for mantis_news_table.date_posted (incorrect for < 0.17 installs)', "UPDATE $t_news_table SET date_posted='1970-01-01 00:00:01' WHERE date_posted='0000-00-00 00:00:00'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-12', 'Set default for mantis_bug_table.date_submitted (incorrect for < 0.17 installs)', "ALTER TABLE $t_bug_table MODIFY date_submitted datetime NOT NULL DEFAULT '1970-01-01 00:00:01'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-13', 'Correct values for mantis_bug_table.date_submitted (incorrect for < 0.17 installs)', "UPDATE $t_bug_table SET date_submitted='1970-01-01 00:00:01' WHERE date_submitted='0000-00-00 00:00:00'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-14', 'Set default for mantis_bugnote_table.date_submitted (incorrect for < 0.17 installs)', "ALTER TABLE $t_bugnote_table MODIFY date_submitted datetime NOT NULL DEFAULT '1970-01-01 00:00:01'" ); $upgrades[] = new SQLUpgrade( '0.17-compat-15', 'Correct values for mantis_bugnote_table.date_submitted (incorrect for < 0.17 installs)', "UPDATE $t_bugnote_table SET date_submitted='1970-01-01 00:00:01' WHERE date_submitted='0000-00-00 00:00:00'" ); # This was added in db_upgrade.sql going from 0.14 to 0.15 but not # added to db_generate.sql. This means that users who installed from # versions after 0.15 don't have it but those from before do. # Because of this, we need a function instead of an SQL statement so # that users from before upgrading with this will not get an error # about the key already existing. $upgrades[] = new FunctionUpgrade( '0.17-compat-16', 'Add unique index to cookie_string if it is not already there (incorrect for > 0.14)', 'upgrade_0_17_compat_16' ); function upgrade_0_17_compat_16() { global $t_user_table; $query = "DESCRIBE $t_user_table cookie_string"; $result = db_query( $query ); $t_row = db_fetch_array( $result ); $t_key = isset( $t_row['Key'] ) ? $t_row['Key'] : $t_row['key']; if ( 'UNI' != $t_key ) { $query = "ALTER IGNORE TABLE $t_user_table ADD UNIQUE cookie_string (cookie_string)"; $result = @db_query( $query ); if ( false == $result ) { return false; } } return true; } $upgrades[] = new FunctionUpgrade( '0.17-compat-17', 'Remove mantis_project_version_table.ver_order (incorrect for < 0.15)', 'upgrade_0_17_compat_17' ); function upgrade_0_17_compat_17() { global $t_project_version_table; $query = "DESCRIBE $t_project_version_table"; $result = db_query( $query ); $count = db_num_rows( $result ); for ( $i=0 ; $i < $count ; $i++ ) { $t_row = db_fetch_array( $result ); $t_field = isset( $t_row['Field'] ) ? $t_row['Field'] : $t_row['field']; if ( $t_field == 'ver_order' ) { $query = "ALTER TABLE $t_project_version_table DROP ver_order"; $result = @db_query( $query ); if ( false == $result ) { return false; } break; } } return true; } $upgrades[] = new SQLUpgrade( '0.17-compat-18', 'Remove users from project 0', "DELETE FROM $t_project_user_list_table WHERE project_id=0" ); $upgrades[] = new FunctionUpgrade( '0.17-vb-19', 'Add id field to bug history table', 'upgrade_0_17_vb_19' ); function upgrade_0_17_vb_19() { global $t_bug_history_table; if ( !db_field_exists( 'id', $t_bug_history_table ) ) { $query = "ALTER TABLE $t_bug_history_table ADD id INT(7) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST"; $result = @db_query( $query ); if ( false == $result ) { return false; } } return true; } return $upgrades;?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -