View Issue Details

IDProjectCategoryView StatusLast Update
0005289mantisbtsqlpublic2007-05-08 03:44
Reportergrangeway Assigned Tograngeway  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Fixed in Version1.0.0 
Summary0005289: Use ADODB DataDict for DB Creation / Upgrade
Description

ADODB contains a datadict. We should make a schema available via it instead of individual mssql.sql, mysql.sql,pgsql.sql files etc.

This could then form part of a new installer / upgrade routine.

TagsNo tags attached.
Attached Files
schema.php.txt (14,890 bytes)   
<?

$upgrade[] = Array(1,'CreateTableSQL',Array($g_mantis_bug_file_table,"
  id			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(2,'CreateTableSQL',Array($g_mantis_bug_history_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  field_name 		C(32) NOTNULL DEFAULT \" '' \",
  old_value 		C(128) NOTNULL DEFAULT \" '' \",
  new_value 		C(128) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0'
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(3,'CreateTableSQL',Array($g_mantis_bug_monitor_table,"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(4,'CreateTableSQL',Array($g_mantis_bug_relationship_table,"
  id 			 I  UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
  source_bug_id		 I  UNSIGNED NOTNULL DEFAULT '0',
  destination_bug_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  relationship_type 	I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(5,'CreateTableSQL',Array($g_mantis_bug_table,"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  handler_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  duplicate_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  priority 		I2 NOTNULL DEFAULT '30',
  severity 		I2 NOTNULL DEFAULT '50',
  reproducibility 	I2 NOTNULL DEFAULT '10',
  status 		I2 NOTNULL DEFAULT '10',
  resolution 		I2 NOTNULL DEFAULT '10',
  projection 		I2 NOTNULL DEFAULT '10',
  category 		C(64) NOTNULL DEFAULT \" '' \",
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  eta 			I2 NOTNULL DEFAULT '10',
  bug_text_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  version 		C(64) NOTNULL DEFAULT \" '' \",
  fixed_in_version 	C(64) NOTNULL DEFAULT \" '' \",
  build 		C(32) NOTNULL DEFAULT \" '' \",
  profile_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  summary 		C(128) NOTNULL DEFAULT \" '' \",
  sponsorship_total 	 I  NOTNULL DEFAULT '0',
  sticky		L  NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(6,'CreateTableSQL',Array($g_mantis_bug_text_table,"
  id 			 I  PRIMARY UNSIGNED NOTNULL AUTOINCREMENT,
  description 		XS NOTNULL,
  steps_to_reproduce 	XS NOTNULL,
  additional_information XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(7,'CreateTableSQL',Array($g_mantis_bugnote_table,"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bugnote_text_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  note_type 		 I  DEFAULT '0',
  note_attr 		C(250) DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(8,'CreateTableSQL',Array($g_mantis_bugnote_text_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  note 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(9,'CreateTableSQL',Array($g_mantis_custom_field_project_table,"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  sequence 		I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(10,'CreateTableSQL',Array($g_mantis_custom_field_string_table,"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  value 		C(255) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(11,'CreateTableSQL',Array($g_mantis_custom_field_table,"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0',
  possible_values 	C(255) NOTNULL DEFAULT \" '' \",
  default_value 	C(255) NOTNULL DEFAULT \" '' \",
  valid_regexp 		C(255) NOTNULL DEFAULT \" '' \",
  access_level_r 	I2 NOTNULL DEFAULT '0',
  access_level_rw 	I2 NOTNULL DEFAULT '0',
  length_min 		 I  NOTNULL DEFAULT '0',
  length_max 		 I  NOTNULL DEFAULT '0',
  advanced 		L NOTNULL DEFAULT '0',
  require_report 	L NOTNULL DEFAULT '0',
  require_update 	L NOTNULL DEFAULT '0',
  display_report 	L NOTNULL DEFAULT '1',
  display_update 	L NOTNULL DEFAULT '1',
  require_resolved 	L NOTNULL DEFAULT '0',
  display_resolved 	L NOTNULL DEFAULT '0',
  display_closed 	L NOTNULL DEFAULT '0',
  require_closed 	L NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(12,'CreateTableSQL',Array($g_mantis_filters_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  NOTNULL DEFAULT '0',
  project_id 		 I  NOTNULL DEFAULT '0',
  is_public 		L DEFAULT NULL,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  filter_string 	XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(13,'CreateTableSQL',Array($g_mantis_news_table,"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  poster_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_posted 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  view_state 		I2 NOTNULL DEFAULT '10',
  announcement 		L NOTNULL DEFAULT '0',
  headline 		C(64) NOTNULL DEFAULT \" '' \",
  body 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(14,'CreateTableSQL',Array($g_mantis_project_category_table,"
  project_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  category 		C(64) NOTNULL PRIMARY DEFAULT \" '' \",
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(15,'CreateTableSQL',Array($g_mantis_project_file_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(16,'CreateTableSQL',Array($g_mantis_project_table,"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  name 			C(128) NOTNULL DEFAULT \" '' \",
  status 		I2 NOTNULL DEFAULT '10',
  enabled 		L NOTNULL DEFAULT '1',
  view_state 		I2 NOTNULL DEFAULT '10',
  access_min 		I2 NOTNULL DEFAULT '10',
  file_path 		C(250) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));



$upgrade[] = Array(17,'CreateTableSQL',Array($g_mantis_project_user_list_table,"
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  user_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(18,'CreateTableSQL',Array($g_mantis_project_version_table,"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  version 		C(64) NOTNULL DEFAULT \" '' \",
  date_order 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  description 		XS NOTNULL,
  released 		L NOTNULL DEFAULT '1'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(19,'CreateTableSQL',Array($g_mantis_sponsorship_table,"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  NOTNULL DEFAULT '0',
  user_id 		 I  NOTNULL DEFAULT '0',
  amount 		 I  NOTNULL DEFAULT '0',
  logo 			C(128) NOTNULL DEFAULT \" '' \",
  url 			C(128) NOTNULL DEFAULT \" '' \",
  paid 			L NOTNULL DEFAULT '0',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(20,'CreateTableSQL',Array($g_mantis_database,"
  schema_version int
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(21,'CreateTableSQL',Array($g_mantis_user_pref_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  default_profile 	 I  UNSIGNED NOTNULL DEFAULT '0',
  default_project 	 I  UNSIGNED NOTNULL DEFAULT '0',
  advanced_report 	L NOTNULL DEFAULT '0',
  advanced_view 	L NOTNULL DEFAULT '0',
  advanced_update 	L NOTNULL DEFAULT '0',
  refresh_delay 	 I  NOTNULL DEFAULT '0',
  redirect_delay 	L NOTNULL DEFAULT '0',
  bugnote_order 	C(4) NOTNULL DEFAULT 'ASC',
  email_on_new 		L NOTNULL DEFAULT '0',
  email_on_assigned 	L NOTNULL DEFAULT '0',
  email_on_feedback 	L NOTNULL DEFAULT '0',
  email_on_resolved	L NOTNULL DEFAULT '0',
  email_on_closed 	L NOTNULL DEFAULT '0',
  email_on_reopened 	L NOTNULL DEFAULT '0',
  email_on_bugnote 	L NOTNULL DEFAULT '0',
  email_on_status 	L NOTNULL DEFAULT '0',
  email_on_priority 	L NOTNULL DEFAULT '0',
  email_on_priority_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_status_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_bugnote_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_reopened_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_closed_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_resolved_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_feedback_minimum_severity	I2 NOTNULL DEFAULT '10',
  email_on_assigned_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_on_new_minimum_severity 	I2 NOTNULL DEFAULT '10',
  email_bugnote_limit 	I2 NOTNULL DEFAULT '0',
  language 		C(32) NOTNULL DEFAULT 'english'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(22,'CreateTableSQL',Array($g_mantis_user_print_pref_table,"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  print_pref 		C(27) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(23,'CreateTableSQL',Array($g_mantis_user_profile_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(24,'CreateTableSQL',Array($g_mantis_user_table,"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  username 		C(32) NOTNULL DEFAULT \" '' \",
  realname 		C(64) NOTNULL DEFAULT \" '' \",
  email 		C(64) NOTNULL DEFAULT \" '' \",
  password 		C(32) NOTNULL DEFAULT \" '' \",
  date_created 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_visit 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  enabled		L NOTNULL DEFAULT '1',
  protected 		L NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10',
  login_count 		 I  NOTNULL DEFAULT '0',
  lost_password_request_count 	I2 NOTNULL DEFAULT '0',
  failed_login_count 	I2 NOTNULL DEFAULT '0',
  cookie_string 	C(64) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(25, 'CreateIndexSQL',Array('idx_bug_file_bug_id',$g_mantis_bug_file_table,'bug_id'));
$upgrade[] = Array(26, 'CreateIndexSQL',Array('idx_bug_history_bug_id',$g_mantis_bug_history_table,'bug_id'));
$upgrade[] = Array(27, 'CreateIndexSQL',Array('idx_user_cookie_string',$g_mantis_user_table,'cookie_string',Array('UNIQUE')));
$upgrade[] = Array(28, 'CreateIndexSQL',Array('idx_user_username',$g_mantis_user_table,'username',Array('UNIQUE')));
$upgrade[] = Array(29, 'CreateIndexSQL',Array('idx_project_id',$g_mantis_project_table,'id'));
$upgrade[] = Array(30, 'CreateIndexSQL',Array('idx_project_name',$g_mantis_project_table,'name',Array('UNIQUE')));
$upgrade[] = Array(31, 'CreateIndexSQL',Array('idx_project_version_project_version',$g_mantis_project_version_table,'project_id,version',Array('UNIQUE')));
$upgrade[] = Array(32, 'CreateIndexSQL',Array('idx_history_user_id',$g_mantis_bug_history_table,'user_id'));
$upgrade[] = Array(33, 'CreateIndexSQL',Array('idx_bug_relationship_source_bug_id',$g_mantis_bug_relationship_table,'source_bug_id'));
$upgrade[] = Array(34, 'CreateIndexSQL',Array('idx_bug_relationship_destination_bug_id',$g_mantis_bug_relationship_table,'destination_bug_id'));
$upgrade[] = Array(35, 'CreateIndexSQL',Array('idx_bug_sponsorship_total',$g_mantis_bug_table,'sponsorship_total'));
$upgrade[] = Array(36, 'CreateIndexSQL',Array('idx_bug_fixed_in_version',$g_mantis_bug_table,'fixed_in_version'));
$upgrade[] = Array(37, 'CreateIndexSQL',Array('idx_custom_field_name',$g_mantis_custom_field_table,'name'));
$upgrade[] = Array(38, 'CreateIndexSQL',Array('idx_news_id',$g_mantis_news_table,'id'));
$upgrade[] = Array(39, 'CreateIndexSQL',Array('idx_sponsorship_table_bug_id',$g_mantis_sponsorship_table,'bug_id'));
$upgrade[] = Array(40, 'CreateIndexSQL',Array('idx_sponsorship_table_user_id',$g_mantis_sponsorship_table,'user_id'));

$upgrade[] = Array(41,'CreateTableSQL',Array($g_mantis_tokens_table,"
			  id I NOTNULL PRIMARY AUTOINCREMENT,
			  owner I NOTNULL,
			  type I NOTNULL,
			  timestamp T NOTNULL,
			  expiry T,
			  value XS NOTNULL",
Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

?>
schema.php.txt (14,890 bytes)   
install.php.txt (9,394 bytes)   
<?php
	# Mantis - a php based bugtracking system
	# Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	# Copyright (C) 2002 - 2004  Mantis Team   - mantisbt-dev@lists.sourceforge.net
	# This program is distributed under the terms and conditions of the GPL
	# See the README and LICENSE files for details

	# --------------------------------------------------------
	# $Id: check.php,v 1.6 2004/03/05 01:26:17 jlatour Exp $
	# --------------------------------------------------------
?>
<?php
	error_reporting( E_ALL );

	//@@@ put this somewhere
	set_time_limit ( 0 ) ;
	$g_skip_open_db = true;  # don't open the database in database_api.php
	@require_once( '../core.php' );

	define( 'BAD', 0 );
	define( 'GOOD', 1 );
	$g_failed = false;

	function print_test_result( $p_result ) {
		global $g_failed;
		if ( BAD == $p_result ) {
			$g_failed = true;
			echo '<td bgcolor="#ff0088">BAD</td>';

		}

		if ( GOOD == $p_result ) {
			echo '<td bgcolor="#00ff88">GOOD</td>';
		}
	}

	//temporary default values
	$t_hostname = 'localhost';
	$t_db_password = '';
	$t_database_name = 'bugtrack';
	$t_db_username = '';

?>
<html>
<head>
<title> Mantis Administration - Pre-Installation Check  </title>
<link rel="stylesheet" type="text/css" href="admin.css" />
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#ffffff">
	<tr class="top-bar">
		<td class="links">
			[ <a href="index.php">Back to Administration</a> ]
		</td>
		<td class="title">
			Pre-Installation Check
		</td>
	</tr>
</table>
<br /><br />

<?php
	require_once( $g_core_path . 'obsolete.php' );
?>

<?php
if ( ! isset( $_REQUEST['go'] ) ) {
?>
<form method='POST'>
<table width="100%" border="0" cellpadding="10" cellspacing="1">
<tr>
	<td bgcolor="#e8e8e8" colspan="2">
		<span class="title">Installation Options</span>
	</td>
</tr>

<tr>
	<td>
		Type of Database
	</td>
	<td>
		<select name="db_type">
		<option value="mysql">MySql (default)</option>
		<option value="odbc_mssql">Microsoft SQL Server ODBC (experimental)</option>
		<option value="ado_mssql">Microsoft SQL Server ADO (experimental)</option>
		<option value="pgsql">PGSQL (experimental)</option>
	</td>
</tr>

<tr>
	<td>
		Hostname (for Database Server)
	</td>
	<td>
		<input name="hostname" type="textbox" value="<?php echo $t_hostname; ?>"></input>
	</td>
</tr>

<tr>
	<td>
		Username (for Database)
	</td>
	<td>
		<input name="db_username" type="textbox" value="<?php echo $t_db_username; ?>"></input>
	</td>
</tr>

<tr>
	<td>
		Password (for Database)
	</td>
	<td>
		<input name="db_password" type="textbox" value="<?php echo $t_db_password; ?>"></input>
	</td>
</tr>

<tr>
	<td>
		Database name (for Database)
	</td>
	<td>
		<input name="database_name" type="textbox" value="<?php echo $t_database_name; ?>"></input>
	</td>
</tr>
<tr>
	<td>
		Attempt Installation
	</td>
	<td>
		<input name="go" type="submit" ></input>
	</td>
</tr>


</table>
</form>

<?php exit();
} ?>

<table width="100%" bgcolor="#222222" border="0" cellpadding="10" cellspacing="1">
<tr>
	<td bgcolor="#e8e8e8" colspan="2">
		<span class="title">Attempting Installation...</span>
	</td>
</tr>

<!-- Check Php Version -->
<tr>
	<td bgcolor="#ffffff">
		Checking  PHP Version (Your version is <?php echo phpversion(); ?>)
	</td>
	<?php
		if (phpversion() == '4.0.6') {
			print_test_result( GOOD );
		} else {
			if ( function_exists ( 'version_compare' ) ) {
				if ( version_compare ( phpversion() , '4.0.6', '>=' ) ) {
					print_test_result( GOOD );
				} else {
					print_test_result( BAD );
				}
			} else {
			 	print_test_result( BAD );
			}
		}
	?>
</tr>

<!-- Check Safe Mode -->
<tr>
	<td bgcolor="#ffffff">
		Checking If Safe mode is enabled for install script
	</td>
	<?php
		if ( ! ini_get ( 'SAFE_MODE' ) ) {
			print_test_result( GOOD );
		} else {
			print_test_result( BAD );
		}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Setting Database Type
	</td>
	<?php
			$f_db_type = gpc_get('db_type', null);
			$g_config_entry['db_type'] = '\''.$f_db_type.'\'';
			if (  isset( $f_db_type ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Checking DB support-->
<tr>
	<td bgcolor="#ffffff">
		Checking PHP support for database type
	</td>
	<?php
			$t_support = false;
			switch ($f_db_type) {
				case 'mysql':
					$t_support = function_exists('mysql_connect');
					break;
				case 'pgsql':
					$t_support = function_exists('pg_connect');
					break;
				case 'mssql':
					$t_support = function_exists('mssql_connect');
					break;
				default:
					$t_support = false;
			}

			if ( $t_support ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Setting Database Hostname
	</td>
	<?php
			$f_hostname = gpc_get('hostname', null);
			$g_config_entry['hostname'] = '\''.$f_hostname.'\'';
			if (  isset( $f_hostname ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Setting Database Username
	</td>
	<?php
			$f_db_username = gpc_get('db_username', null);
			$g_config_entry['db_username'] = '\''.$f_db_username.'\'';
			if (  isset( $f_db_username ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Setting Database Password
	</td>
	<?php
			$f_db_password = gpc_get('db_password', null);
			$g_config_entry['db_password'] = '\''.$f_db_password.'\'';
			if (  isset( $f_db_password ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Setting Database Name
	</td>
	<?php
			$f_database_name = gpc_get('database_name', null);
			$g_config_entry['database_name'] = '\''.$f_database_name.'\'';
			if (  isset( $f_database_name ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	?>
</tr>

<!-- Setting config variables -->
<tr>
	<td bgcolor="#ffffff">
		Attempting to connect to database
	</td>
	<?php
		$g_db = $db = ADONewConnection($f_db_type);
		$t_result = @$g_db->Connect($f_hostname, $f_db_username, $f_db_password);

		if ( $t_result == true ) {
			print_test_result( GOOD );
		} else {
			print_test_result( BAD );
		}
	?>
</tr>

<!-- Checking MD5 -->
<tr>
	<td bgcolor="#ffffff">
		Checking for MD5 Crypt() support
	</td>
	<?php
		if ( 1 === CRYPT_MD5 ) {
			print_test_result( GOOD );
		} else {
			print_test_result( BAD );
		}
	?>
</tr>

<!-- Checking register_globals are off -->
<tr>
	<td bgcolor="#ffffff">
		Checking for register_globals are off for mantis
	</td>
	<?php
		if ( ! ini_get_bool( 'register_globals' ) ) {
			print_test_result( GOOD );
		} else {
			print_test_result( BAD );
		}
	?>
</tr>

<tr>
	<td bgcolor="#ffffff">
		Create database if it does not exist
	</td>
	<?php
		$t_result = @$g_db->Connect($f_hostname, $f_db_username, $f_db_password, $f_database_name);

		if ( $t_result == true ) {
			print_test_result( GOOD );
		} else {
			// create db
			$g_db = ADONewConnection($f_db_type);
			$t_result = $g_db->Connect($f_hostname, $f_db_username, $f_db_password);
			$dict = NewDataDictionary($g_db);
			$sqlarray = $dict->CreateDatabase($f_database_name);
			$ret = $dict->ExecuteSQLArray($sqlarray);
			if( $ret == 2) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
	}
	?>
</tr>

<?php
	include "schema.php";
	$g_db = ADONewConnection($f_db_type);
	$t_result = @$g_db->Connect($f_hostname, $f_db_username, $f_db_password, $f_database_name);
	$lastid = sizeof($upgrade);
	for($i = 0; $i < $lastid; $i++) {
?>
<tr>
	<td bgcolor="#ffffff">
		Create Schema ( Upgrading Schema to Version <?php echo $i?> )
	</td>
<?php
		$dict = NewDataDictionary($g_db);
		$sqlarray = call_user_func_array(Array($dict,$upgrade[$i][1]),$upgrade[$i][2]);
		$ret = $dict->ExecuteSQLArray($sqlarray);
		if ( $ret == 2 ) {
			print_test_result( GOOD );
		} else {
			var_dump($sqlarray);
			print_test_result( BAD );
		}
echo '</tr>';
	}
?>

<tr>
	<td bgcolor="#ffffff">
		Creating Default Config File
	</td>
	<?php
		if ( /*!$g_failed &&*/ ! file_exists ( $g_absolute_path .DIRECTORY_SEPARATOR.'config_inc.php' ) ) {
			$fd = fopen($g_absolute_path.DIRECTORY_SEPARATOR.'config_inc.php','x');
			fwrite($fd, '<?php'."\r\n");
			foreach ( $g_config_entry as $key => $value) {
				fwrite($fd,'$g_'.$key.'='.$value.";\r\n");
			}
			fwrite($fd, '?>'."\r\n");

			fclose($fd);
			if ( file_exists ( $g_absolute_path .DIRECTORY_SEPARATOR.'config_inc.php' ) ) {
				print_test_result( GOOD );
			} else {
				print_test_result( BAD );
			}
		} else {
			// already exists
			print_test_result( BAD );

		}
	?>
</tr>
</table>

<?php if( $g_failed ) { ?>
	<p>Please correct failed checks</p>
<?php } ?>

</body>
</html>
install.php.txt (9,394 bytes)   
schema.php.2 (15,255 bytes)   
<?

$upgrade[] = Array(1,'CreateTableSQL',Array(config_get('mantis_bug_file_table'),"
  id			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(2,'CreateTableSQL',Array(config_get('mantis_bug_history_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  field_name 		C(32) NOTNULL DEFAULT \" '' \",
  old_value 		C(128) NOTNULL DEFAULT \" '' \",
  new_value 		C(128) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0'
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(3,'CreateTableSQL',Array(config_get('mantis_bug_monitor_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(4,'CreateTableSQL',Array(config_get('mantis_bug_relationship_table'),"
  id 			 I  UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
  source_bug_id		 I  UNSIGNED NOTNULL DEFAULT '0',
  destination_bug_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  relationship_type 	I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(5,'CreateTableSQL',Array(config_get('mantis_bug_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  handler_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  duplicate_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  priority 		I2 NOTNULL DEFAULT '30',
  severity 		I2 NOTNULL DEFAULT '50',
  reproducibility 	I2 NOTNULL DEFAULT '10',
  status 		I2 NOTNULL DEFAULT '10',
  resolution 		I2 NOTNULL DEFAULT '10',
  projection 		I2 NOTNULL DEFAULT '10',
  category 		C(64) NOTNULL DEFAULT \" '' \",
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  eta 			I2 NOTNULL DEFAULT '10',
  bug_text_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  version 		C(64) NOTNULL DEFAULT \" '' \",
  fixed_in_version 	C(64) NOTNULL DEFAULT \" '' \",
  build 		C(32) NOTNULL DEFAULT \" '' \",
  profile_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  summary 		C(128) NOTNULL DEFAULT \" '' \",
  sponsorship_total 	 I  NOTNULL DEFAULT '0',
  sticky		L  NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(6,'CreateTableSQL',Array(config_get('mantis_bug_text_table'),"
  id 			 I  PRIMARY UNSIGNED NOTNULL AUTOINCREMENT,
  description 		XS NOTNULL,
  steps_to_reproduce 	XS NOTNULL,
  additional_information XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(7,'CreateTableSQL',Array(config_get('mantis_bugnote_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bugnote_text_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  note_type 		 I  DEFAULT '0',
  note_attr 		C(250) DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(8,'CreateTableSQL',Array(config_get('mantis_bugnote_text_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  note 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(9,'CreateTableSQL',Array(config_get('mantis_custom_field_project_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  sequence 		I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(10,'CreateTableSQL',Array(config_get('mantis_custom_field_string_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  value 		C(255) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(11,'CreateTableSQL',Array(config_get('mantis_custom_field_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0',
  possible_values 	C(255) NOTNULL DEFAULT \" '' \",
  default_value 	C(255) NOTNULL DEFAULT \" '' \",
  valid_regexp 		C(255) NOTNULL DEFAULT \" '' \",
  access_level_r 	I2 NOTNULL DEFAULT '0',
  access_level_rw 	I2 NOTNULL DEFAULT '0',
  length_min 		 I  NOTNULL DEFAULT '0',
  length_max 		 I  NOTNULL DEFAULT '0',
  advanced 		L NOTNULL DEFAULT '0',
  require_report 	L NOTNULL DEFAULT '0',
  require_update 	L NOTNULL DEFAULT '0',
  display_report 	L NOTNULL DEFAULT '1',
  display_update 	L NOTNULL DEFAULT '1',
  require_resolved 	L NOTNULL DEFAULT '0',
  display_resolved 	L NOTNULL DEFAULT '0',
  display_closed 	L NOTNULL DEFAULT '0',
  require_closed 	L NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(12,'CreateTableSQL',Array(config_get('mantis_filters_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  NOTNULL DEFAULT '0',
  project_id 		 I  NOTNULL DEFAULT '0',
  is_public 		L DEFAULT NULL,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  filter_string 	XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(13,'CreateTableSQL',Array(config_get('mantis_news_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  poster_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_posted 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  view_state 		I2 NOTNULL DEFAULT '10',
  announcement 		L NOTNULL DEFAULT '0',
  headline 		C(64) NOTNULL DEFAULT \" '' \",
  body 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(14,'CreateTableSQL',Array(config_get('mantis_project_category_table'),"
  project_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  category 		C(64) NOTNULL PRIMARY DEFAULT \" '' \",
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(15,'CreateTableSQL',Array(config_get('mantis_project_file_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(16,'CreateTableSQL',Array(config_get('mantis_project_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  name 			C(128) NOTNULL DEFAULT \" '' \",
  status 		I2 NOTNULL DEFAULT '10',
  enabled 		L NOTNULL DEFAULT '1',
  view_state 		I2 NOTNULL DEFAULT '10',
  access_min 		I2 NOTNULL DEFAULT '10',
  file_path 		C(250) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));



$upgrade[] = Array(17,'CreateTableSQL',Array(config_get('mantis_project_user_list_table'),"
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  user_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(18,'CreateTableSQL',Array(config_get('mantis_project_version_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  version 		C(64) NOTNULL DEFAULT \" '' \",
  date_order 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  description 		XS NOTNULL,
  released 		L NOTNULL DEFAULT '1'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(19,'CreateTableSQL',Array(config_get('mantis_sponsorship_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  NOTNULL DEFAULT '0',
  user_id 		 I  NOTNULL DEFAULT '0',
  amount 		 I  NOTNULL DEFAULT '0',
  logo 			C(128) NOTNULL DEFAULT \" '' \",
  url 			C(128) NOTNULL DEFAULT \" '' \",
  paid 			L NOTNULL DEFAULT '0',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(20,'CreateTableSQL',Array(config_get('mantis_database'),"
  schema_version int
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(21,'CreateTableSQL',Array(config_get('mantis_user_pref_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  default_profile 	 I  UNSIGNED NOTNULL DEFAULT '0',
  default_project 	 I  UNSIGNED NOTNULL DEFAULT '0',
  advanced_report 	L NOTNULL DEFAULT '0',
  advanced_view 	L NOTNULL DEFAULT '0',
  advanced_update 	L NOTNULL DEFAULT '0',
  refresh_delay 	 I  NOTNULL DEFAULT '0',
  redirect_delay 	L NOTNULL DEFAULT '0',
  bugnote_order 	C(4) NOTNULL DEFAULT 'ASC',
  email_on_new 		L NOTNULL DEFAULT '0',
  email_on_assigned 	L NOTNULL DEFAULT '0',
  email_on_feedback 	L NOTNULL DEFAULT '0',
  email_on_resolved	L NOTNULL DEFAULT '0',
  email_on_closed 	L NOTNULL DEFAULT '0',
  email_on_reopened 	L NOTNULL DEFAULT '0',
  email_on_bugnote 	L NOTNULL DEFAULT '0',
  email_on_status 	L NOTNULL DEFAULT '0',
  email_on_priority 	L NOTNULL DEFAULT '0',
  email_on_priority_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_status_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_bugnote_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_reopened_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_closed_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_resolved_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_feedback_min_severity	I2 NOTNULL DEFAULT '10',
  email_on_assigned_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_new_min_severity 	I2 NOTNULL DEFAULT '10',
  email_bugnote_limit 	I2 NOTNULL DEFAULT '0',
  language 		C(32) NOTNULL DEFAULT 'english'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(22,'CreateTableSQL',Array(config_get('mantis_user_print_pref_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  print_pref 		C(27) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(23,'CreateTableSQL',Array(config_get('mantis_user_profile_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(24,'CreateTableSQL',Array(config_get('mantis_user_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  username 		C(32) NOTNULL DEFAULT \" '' \",
  realname 		C(64) NOTNULL DEFAULT \" '' \",
  email 		C(64) NOTNULL DEFAULT \" '' \",
  password 		C(32) NOTNULL DEFAULT \" '' \",
  date_created 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_visit 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  enabled		L NOTNULL DEFAULT '1',
  protected 		L NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10',
  login_count 		 I  NOTNULL DEFAULT '0',
  lost_password_request_count 	I2 NOTNULL DEFAULT '0',
  failed_login_count 	I2 NOTNULL DEFAULT '0',
  cookie_string 	C(64) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(25, 'CreateIndexSQL',Array('idx_bug_file_bug_id',config_get('mantis_bug_file_table'),'bug_id'));
$upgrade[] = Array(26, 'CreateIndexSQL',Array('idx_bug_history_bug_id',config_get('mantis_bug_history_table'),'bug_id'));
$upgrade[] = Array(27, 'CreateIndexSQL',Array('idx_user_cookie_string',config_get('mantis_user_table'),'cookie_string',Array('UNIQUE')));
$upgrade[] = Array(28, 'CreateIndexSQL',Array('idx_user_username',config_get('mantis_user_table'),'username',Array('UNIQUE')));
$upgrade[] = Array(29, 'CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id'));
$upgrade[] = Array(30, 'CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE')));
$upgrade[] = Array(31, 'CreateIndexSQL',Array('idx_project_version',config_get('mantis_project_version_table'),'project_id,version',Array('UNIQUE')));
$upgrade[] = Array(32, 'CreateIndexSQL',Array('idx_history_user_id',config_get('mantis_bug_history_table'),'user_id'));
$upgrade[] = Array(33, 'CreateIndexSQL',Array('idx_relationship_source',config_get('mantis_bug_relationship_table'),'source_bug_id'));
$upgrade[] = Array(34, 'CreateIndexSQL',Array('idx_relationship_destination',config_get('mantis_bug_relationship_table'),'destination_bug_id'));
$upgrade[] = Array(35, 'CreateIndexSQL',Array('idx_bug_sponsorship_total',config_get('mantis_bug_table'),'sponsorship_total'));
$upgrade[] = Array(36, 'CreateIndexSQL',Array('idx_bug_fixed_in_version',config_get('mantis_bug_table'),'fixed_in_version'));
$upgrade[] = Array(37, 'CreateIndexSQL',Array('idx_custom_field_name',config_get('mantis_custom_field_table'),'name'));
$upgrade[] = Array(38, 'CreateIndexSQL',Array('idx_news_id',config_get('mantis_news_table'),'id'));
$upgrade[] = Array(39, 'CreateIndexSQL',Array('idx_sponsorship_bug_id',config_get('mantis_sponsorship_table'),'bug_id'));
$upgrade[] = Array(40, 'CreateIndexSQL',Array('idx_sponsorship_user_id',config_get('mantis_sponsorship_table'),'user_id'));

$upgrade[] = Array(41,'CreateTableSQL',Array(config_get('mantis_tokens_table'),"
			  id I NOTNULL PRIMARY AUTOINCREMENT,
			  owner I NOTNULL,
			  type I NOTNULL,
			  timestamp T NOTNULL,
			  expiry T,
			  value XS NOTNULL",
Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

?>
schema.php.2 (15,255 bytes)   
schema.php.3 (15,929 bytes)   
<?

$upgrade[] = Array(1,'CreateTableSQL',Array(config_get('mantis_bug_file_table'),"
  id			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(2,'CreateTableSQL',Array(config_get('mantis_bug_history_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  field_name 		C(32) NOTNULL DEFAULT \" '' \",
  old_value 		C(128) NOTNULL DEFAULT \" '' \",
  new_value 		C(128) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0'
  ",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(3,'CreateTableSQL',Array(config_get('mantis_bug_monitor_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(4,'CreateTableSQL',Array(config_get('mantis_bug_relationship_table'),"
  id 			 I  UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
  source_bug_id		 I  UNSIGNED NOTNULL DEFAULT '0',
  destination_bug_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  relationship_type 	I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(5,'CreateTableSQL',Array(config_get('mantis_bug_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  handler_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  duplicate_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  priority 		I2 NOTNULL DEFAULT '30',
  severity 		I2 NOTNULL DEFAULT '50',
  reproducibility 	I2 NOTNULL DEFAULT '10',
  status 		I2 NOTNULL DEFAULT '10',
  resolution 		I2 NOTNULL DEFAULT '10',
  projection 		I2 NOTNULL DEFAULT '10',
  category 		C(64) NOTNULL DEFAULT \" '' \",
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  eta 			I2 NOTNULL DEFAULT '10',
  bug_text_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  version 		C(64) NOTNULL DEFAULT \" '' \",
  fixed_in_version 	C(64) NOTNULL DEFAULT \" '' \",
  build 		C(32) NOTNULL DEFAULT \" '' \",
  profile_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  summary 		C(128) NOTNULL DEFAULT \" '' \",
  sponsorship_total 	 I  NOTNULL DEFAULT '0',
  sticky		L  NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(6,'CreateTableSQL',Array(config_get('mantis_bug_text_table'),"
  id 			 I  PRIMARY UNSIGNED NOTNULL AUTOINCREMENT,
  description 		XS NOTNULL,
  steps_to_reproduce 	XS NOTNULL,
  additional_information XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(7,'CreateTableSQL',Array(config_get('mantis_bugnote_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  bug_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  reporter_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  bugnote_text_id 	 I  UNSIGNED NOTNULL DEFAULT '0',
  view_state 		I2 NOTNULL DEFAULT '10',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  note_type 		 I  DEFAULT '0',
  note_attr 		C(250) DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(8,'CreateTableSQL',Array(config_get('mantis_bugnote_text_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  note 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(9,'CreateTableSQL',Array(config_get('mantis_custom_field_project_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  sequence 		I2 NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(10,'CreateTableSQL',Array(config_get('mantis_custom_field_string_table'),"
  field_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  bug_id 		 I  NOTNULL PRIMARY DEFAULT '0',
  value 		C(255) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(11,'CreateTableSQL',Array(config_get('mantis_custom_field_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  type 			I2 NOTNULL DEFAULT '0',
  possible_values 	C(255) NOTNULL DEFAULT \" '' \",
  default_value 	C(255) NOTNULL DEFAULT \" '' \",
  valid_regexp 		C(255) NOTNULL DEFAULT \" '' \",
  access_level_r 	I2 NOTNULL DEFAULT '0',
  access_level_rw 	I2 NOTNULL DEFAULT '0',
  length_min 		 I  NOTNULL DEFAULT '0',
  length_max 		 I  NOTNULL DEFAULT '0',
  advanced 		L NOTNULL DEFAULT '0',
  require_report 	L NOTNULL DEFAULT '0',
  require_update 	L NOTNULL DEFAULT '0',
  display_report 	L NOTNULL DEFAULT '1',
  display_update 	L NOTNULL DEFAULT '1',
  require_resolved 	L NOTNULL DEFAULT '0',
  display_resolved 	L NOTNULL DEFAULT '0',
  display_closed 	L NOTNULL DEFAULT '0',
  require_closed 	L NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(12,'CreateTableSQL',Array(config_get('mantis_filters_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  NOTNULL DEFAULT '0',
  project_id 		 I  NOTNULL DEFAULT '0',
  is_public 		L DEFAULT NULL,
  name 			C(64) NOTNULL DEFAULT \" '' \",
  filter_string 	XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(13,'CreateTableSQL',Array(config_get('mantis_news_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  poster_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  date_posted 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_modified 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  view_state 		I2 NOTNULL DEFAULT '10',
  announcement 		L NOTNULL DEFAULT '0',
  headline 		C(64) NOTNULL DEFAULT \" '' \",
  body 			XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(14,'CreateTableSQL',Array(config_get('mantis_project_category_table'),"
  project_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  category 		C(64) NOTNULL PRIMARY DEFAULT \" '' \",
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(15,'CreateTableSQL',Array(config_get('mantis_project_file_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  title 		C(250) NOTNULL DEFAULT \" '' \",
  description 		C(250) NOTNULL DEFAULT \" '' \",
  diskfile 		C(250) NOTNULL DEFAULT \" '' \",
  filename 		C(250) NOTNULL DEFAULT \" '' \",
  folder 		C(250) NOTNULL DEFAULT \" '' \",
  filesize 		 I NOTNULL DEFAULT '0',
  file_type 		C(250) NOTNULL DEFAULT \" '' \",
  date_added 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  content 		B NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(16,'CreateTableSQL',Array(config_get('mantis_project_table'),"
  id 			 I  UNSIGNED PRIMARY NOTNULL AUTOINCREMENT,
  name 			C(128) NOTNULL DEFAULT \" '' \",
  status 		I2 NOTNULL DEFAULT '10',
  enabled 		L NOTNULL DEFAULT '1',
  view_state 		I2 NOTNULL DEFAULT '10',
  access_min 		I2 NOTNULL DEFAULT '10',
  file_path 		C(250) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));



$upgrade[] = Array(17,'CreateTableSQL',Array(config_get('mantis_project_user_list_table'),"
  project_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  user_id 		 I  UNSIGNED PRIMARY NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(18,'CreateTableSQL',Array(config_get('mantis_project_version_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  version 		C(64) NOTNULL DEFAULT \" '' \",
  date_order 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  description 		XS NOTNULL,
  released 		L NOTNULL DEFAULT '1'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(19,'CreateTableSQL',Array(config_get('mantis_sponsorship_table'),"
  id 			 I  NOTNULL PRIMARY AUTOINCREMENT,
  bug_id 		 I  NOTNULL DEFAULT '0',
  user_id 		 I  NOTNULL DEFAULT '0',
  amount 		 I  NOTNULL DEFAULT '0',
  logo 			C(128) NOTNULL DEFAULT \" '' \",
  url 			C(128) NOTNULL DEFAULT \" '' \",
  paid 			L NOTNULL DEFAULT '0',
  date_submitted 	T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_updated 		T NOTNULL DEFAULT '1970-01-01 00:00:01'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(20,'CreateTableSQL',Array(config_get('mantis_database'),"
  schema_version int
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(21,'CreateTableSQL',Array(config_get('mantis_user_pref_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  project_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  default_profile 	 I  UNSIGNED NOTNULL DEFAULT '0',
  default_project 	 I  UNSIGNED NOTNULL DEFAULT '0',
  advanced_report 	L NOTNULL DEFAULT '0',
  advanced_view 	L NOTNULL DEFAULT '0',
  advanced_update 	L NOTNULL DEFAULT '0',
  refresh_delay 	 I  NOTNULL DEFAULT '0',
  redirect_delay 	L NOTNULL DEFAULT '0',
  bugnote_order 	C(4) NOTNULL DEFAULT 'ASC',
  email_on_new 		L NOTNULL DEFAULT '0',
  email_on_assigned 	L NOTNULL DEFAULT '0',
  email_on_feedback 	L NOTNULL DEFAULT '0',
  email_on_resolved	L NOTNULL DEFAULT '0',
  email_on_closed 	L NOTNULL DEFAULT '0',
  email_on_reopened 	L NOTNULL DEFAULT '0',
  email_on_bugnote 	L NOTNULL DEFAULT '0',
  email_on_status 	L NOTNULL DEFAULT '0',
  email_on_priority 	L NOTNULL DEFAULT '0',
  email_on_priority_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_status_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_bugnote_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_reopened_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_closed_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_resolved_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_feedback_min_severity	I2 NOTNULL DEFAULT '10',
  email_on_assigned_min_severity 	I2 NOTNULL DEFAULT '10',
  email_on_new_min_severity 	I2 NOTNULL DEFAULT '10',
  email_bugnote_limit 	I2 NOTNULL DEFAULT '0',
  language 		C(32) NOTNULL DEFAULT 'english'
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(22,'CreateTableSQL',Array(config_get('mantis_user_print_pref_table'),"
  user_id 		 I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
  print_pref 		C(27) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(23,'CreateTableSQL',Array(config_get('mantis_user_profile_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  user_id 		 I  UNSIGNED NOTNULL DEFAULT '0',
  platform 		C(32) NOTNULL DEFAULT \" '' \",
  os 			C(32) NOTNULL DEFAULT \" '' \",
  os_build 		C(32) NOTNULL DEFAULT \" '' \",
  description 		XS NOTNULL
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(24,'CreateTableSQL',Array(config_get('mantis_user_table'),"
  id 			 I  UNSIGNED NOTNULL PRIMARY AUTOINCREMENT,
  username 		C(32) NOTNULL DEFAULT \" '' \",
  realname 		C(64) NOTNULL DEFAULT \" '' \",
  email 		C(64) NOTNULL DEFAULT \" '' \",
  password 		C(32) NOTNULL DEFAULT \" '' \",
  date_created 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  last_visit 		T NOTNULL DEFAULT '1970-01-01 00:00:01',
  enabled		L NOTNULL DEFAULT '1',
  protected 		L NOTNULL DEFAULT '0',
  access_level 		I2 NOTNULL DEFAULT '10',
  login_count 		 I  NOTNULL DEFAULT '0',
  lost_password_request_count 	I2 NOTNULL DEFAULT '0',
  failed_login_count 	I2 NOTNULL DEFAULT '0',
  cookie_string 	C(64) NOTNULL DEFAULT \" '' \"
",Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(25, 'CreateIndexSQL',Array('idx_bug_file_bug_id',config_get('mantis_bug_file_table'),'bug_id'));
$upgrade[] = Array(26, 'CreateIndexSQL',Array('idx_bug_history_bug_id',config_get('mantis_bug_history_table'),'bug_id'));
$upgrade[] = Array(27, 'CreateIndexSQL',Array('idx_user_cookie_string',config_get('mantis_user_table'),'cookie_string',Array('UNIQUE')));
$upgrade[] = Array(28, 'CreateIndexSQL',Array('idx_user_username',config_get('mantis_user_table'),'username',Array('UNIQUE')));
$upgrade[] = Array(29, 'CreateIndexSQL',Array('idx_project_id',config_get('mantis_project_table'),'id'));
$upgrade[] = Array(30, 'CreateIndexSQL',Array('idx_project_name',config_get('mantis_project_table'),'name',Array('UNIQUE')));
$upgrade[] = Array(31, 'CreateIndexSQL',Array('idx_project_version',config_get('mantis_project_version_table'),'project_id,version',Array('UNIQUE')));
$upgrade[] = Array(32, 'CreateIndexSQL',Array('idx_history_user_id',config_get('mantis_bug_history_table'),'user_id'));
$upgrade[] = Array(33, 'CreateIndexSQL',Array('idx_relationship_source',config_get('mantis_bug_relationship_table'),'source_bug_id'));
$upgrade[] = Array(34, 'CreateIndexSQL',Array('idx_relationship_destination',config_get('mantis_bug_relationship_table'),'destination_bug_id'));
$upgrade[] = Array(35, 'CreateIndexSQL',Array('idx_bug_sponsorship_total',config_get('mantis_bug_table'),'sponsorship_total'));
$upgrade[] = Array(36, 'CreateIndexSQL',Array('idx_bug_fixed_in_version',config_get('mantis_bug_table'),'fixed_in_version'));
$upgrade[] = Array(37, 'CreateIndexSQL',Array('idx_custom_field_name',config_get('mantis_custom_field_table'),'name'));
$upgrade[] = Array(38, 'CreateIndexSQL',Array('idx_news_id',config_get('mantis_news_table'),'id'));
$upgrade[] = Array(39, 'CreateIndexSQL',Array('idx_sponsorship_bug_id',config_get('mantis_sponsorship_table'),'bug_id'));
$upgrade[] = Array(40, 'CreateIndexSQL',Array('idx_sponsorship_user_id',config_get('mantis_sponsorship_table'),'user_id'));

$upgrade[] = Array(41,'CreateTableSQL',Array(config_get('mantis_tokens_table'),"
			  id I NOTNULL PRIMARY AUTOINCREMENT,
			  owner I NOTNULL,
			  type I NOTNULL,
			  timestamp T NOTNULL,
			  expiry T,
			  value XS NOTNULL",
Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(42,'CreateTableSQL',Array(config_get('mantis_project_hierarchy_table'),"
			  child_id I UNSIGNED NOTNULL,
			  parent_id I UNSIGNED NOTNULL",
Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));

$upgrade[] = Array(42,'CreateTableSQL',Array(config_get('mantis_config_table'),"
			  config_id C(64) NOTNULL,
			  project_id I DEFAULT '0',
			  user_id I DEFAULT '0',
			  access I DEFAULT '0',
			  type I DEFAULT '90',
			  value XS NOTNULL",
Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));


/*
CREATE TABLE $t_config_table (
			  INDEX (config_id),
			  UNIQUE config ( config_id, project_id, user_id ) )
 */
?>
schema.php.3 (15,929 bytes)   

Relationships

parent of 0004871 closedgrangeway New SQL script for PostgreSQL port 
has duplicate 0004846 closedgrangeway MSSQL DB creation : mantis_user_pref_table 
has duplicate 0004845 closedgrangeway MSSQL DB creation : mantis_filters_table 
has duplicate 0004504 closedgrangeway Using ADODB XML Schema for DB Creation 
related to 0005540 closedvboctor PostgreSQL script does not match MySQL script 
related to 0006853 closeddregad Instalation in oracle Database ... 
related to 0007644 closeddregad Problems when creating the Mantis database schema on Oracle 

Activities

zariok

zariok

2005-03-03 12:41

reporter   ~0009465

Last edited: 2005-03-03 12:42

Per a forum request:

http://forums.mantisbt.org/viewtopic.php?t=61
(General Discussion > DB Abstraction)

I would like to assist in testing/porting the db backend to various databases in this particular order: Oracle, SQLite, and PostgreSQL.

zariok

zariok

2005-03-03 18:40

reporter   ~0009476

Oracle (oci8) needs this run prior to create tables with default dates to ensure it will take the date format:

ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS';

grangeway

grangeway

2005-03-05 06:10

reporter   ~0009480

heh, guess we need to add some blank upgrades before upgrade 0 to that schema then.
Does the ALTER SESSION just need to be called once or before each time a user makes a new connection to the db?

zariok

zariok

2005-03-05 21:38

reporter   ~0009485

Once per new db connection. A DBA can set up that NLS_DATE_FORMAT as a default, but we can't assume this is done.

Narcissus

Narcissus

2005-03-11 20:18

reporter   ~0009518

I just wanted to bring my note on 0004504 (which you can close if you like) across to here...

Once this is sorted out, I think we should provide an easy way to move data from one database/server to another. I've currently got a script that works for me, but will try and do some more testing before attaching it.

zariok

zariok

2005-03-16 18:09

reporter   ~0009563

Last edited: 2005-03-17 15:09

Oracle Specific Issues:

Identifiers to long on tables:
mantis_user_pref table

  • email_on_priority_minimum_severity
  • email_on_status_minimum_severity
  • email_on_bugnote_minimum_severity
  • email_on_reopened_minimum_severity
  • email_on_closed_minimum_severity
  • email_on_resolved_minimum_severity
  • email_on_feedback_minimum_severity
  • email_on_assigned_minimum_severity
    mantis_user table
  • lost_password_in_progress_count (resolved???)

Trigger Identifiers to long:

  • TRIG_SEQ_mantis_bug_relationship (schema 3)
  • TRIG_SEQ_mantis_project_version (schema 17)

Index Identifiers to long:

  • idx_project_version_project_version (schema 30)
  • idx_bug_relationship_source_bug_id (schema 32)

I get an "such colum list already indexed" error for:
CREATE INDEX idx_news_id ON mantis_news (id) (schema 40)


For date fields to take:

core/adodb/drivers/adodb-oci8.inc.php Line#84
Needs to include the HH24:MI:SS

zariok

zariok

2005-03-16 18:11

reporter   ~0009564

In install.php:

Around like #317 "Attempting to connect to database"

The connect method call is missing "$f_database_name" causing a false fail on the ability to connect to database.

Should be:
$t_result = @$g_db->Connect($f_hostname, $f_db_username, $f_db_password, $f_database_name);

grangeway

grangeway

2005-03-16 18:44

reporter   ~0009565

The following change is required to config_defaults for schema to import using install.php:
$g_mantis_database = '%db_table_prefix%_mantis_database';

zariok

zariok

2005-03-16 19:12

reporter   ~0009566

Last edited: 2005-03-17 15:04

Invalid SQL Generated in/for install.php (col type of "xs") for OCI8:

CREATE TABLE mantis_bug_text (
id DECIMAL(10) NOT NULL,
description XS NOT NULL,
steps_to_reproduce XS NOT NULL,
additional_information XS NOT NULL,
PRIMARY KEY (id)
)

The problem is a missing type "XS" in core/adodb/datadict/datadict-oci8.inc.php
case 'XS': return 'varchar(4000)';

zariok

zariok

2005-03-17 15:28

reporter   ~0009573

Per thraxisp, 2005.03.17, via IIRC:

schema.php should be further modified to reference the $g_mantis_TABLENAME via config_get('mantis_TABLENAME')

Example:
$upgrade[] = Array(1,'CreateTableSQL',Array($g_mantis_bug_file_table,"
to
$upgrade[] = Array(1,'CreateTableSQL',Array(config_get('mantis_bug_file_table'),"

grangeway

grangeway

2005-03-17 19:48

reporter   ~0009579

"
The problem is a missing type "XS" in core/adodb/datadict/datadict-oci8.inc.php
case 'XS': return 'varchar(4000)';
"
If someone's entering a bug via oracle, it's feasible with debug output it might take >4000 chars.

Other than varchar(4000), what are the other data formats that could be used for XS?

Paul

zariok

zariok

2005-03-18 00:33

reporter   ~0009582

Use CLOB (char blob) for up to 2GB of space.

grangeway

grangeway

2005-03-18 07:07

reporter   ~0009585

If there's no downsides to using 'clobs', I guess that would be more appropriate than a varchar field.

zariok

zariok

2005-03-18 12:33

reporter   ~0009587

I dont see any issues unless adodb can not handle the CLOB object from oracle.

In a project at work for credit checking processing with Dunns & Bradstreet, I had to break the returned report into two and put it in two seperate varchar(4000) fields.

zariok

zariok

2005-03-23 16:40

reporter   ~0009649

From the latest provided schema.php:

mantis_config table has a column "access", this is a reserved word in Oracle.

zariok

zariok

2005-03-23 16:49

reporter   ~0009650

Last edited: 2005-03-23 18:23

schema.php.3 has fields as NOT NULL when NULL is allowed within application (CVS HEAD).

Table:
mantis_user_profile_table
Field:
description

Table:
mantis_bug_text_table
Fields:
steps_to_reproduce
additional_information

thraxisp

thraxisp

2005-04-26 13:36

reporter   ~0009924

Initial cut at installer put in CVS.

admin/install.php -> 1.1
admin/schema.php -> 1.1
core.php -> 1.40
config_defaults_inc.php -> 1.259

dartcafe

dartcafe

2005-05-17 06:03

reporter   ~0010154

That´s funny, I accidentially clicked on "Sponsor". Didn´t really want to sponsor this issue.... Sorry for that.

br8kwall

br8kwall

2005-06-14 19:03

reporter   ~0010529

What's the status of getting mantis working with oracle? we'd love to help if it's stalled.

thraxisp

thraxisp

2005-07-05 15:33

reporter   ~0010670

The last db column naming fix (_miminum_severity -> _min_severity) is in CVS.
account_prefs_inc.php -> 1.33
account_prefs_update.php -> 1.36
core/email_api.php -> 1.120
core/user_pref_api.php -> 1.25
admin/upgrades/1_00_inc.php ->1.7

An almost ready for prime time version of the installer is in CVS. This is tested on mysql, but not others.
admin/install.php -> 1.3
admin/schema.php -> 1.4

zariok

zariok

2005-10-12 14:27

reporter   ~0011489

This effort still underway?

thraxisp

thraxisp

2005-10-12 17:09

reporter   ~0011492

All of this is in 1.0.0rc2. It's not been well tested on dbs other than MySQL and PostgreSQL.

grangeway

grangeway

2006-04-17 09:10

reporter   ~0012519

Hello Guys,

I Think that the original bug issue has been 'resolved' at least for mysql (and alpha(beta?) : pgsql/mssql.

There's obviously a few people interesting in other databases e.g. oracle. I think for the sake of sanity the best thing to do from here is:
a) I will resolve this issue now
b) if someone has an issue with the current schema in mantis 1.0.1 etc, that needs modifying to support another db or improves mssql/pgsql support - then can we get those raised as seperate issues.
c) zariok/others - if your still intersted in getting oracle up and running, and would be willing to do some more testing, can you let us know. As far as i'm aware, none of the core dev team have access to an oracle database.

Paul