Skip to content

Commit

Permalink
updagrade scripts for 0.16.0
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@531 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Nov 27, 2001
1 parent 0ace012 commit b827897
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 10 deletions.
4 changes: 3 additions & 1 deletion admin_upgrade.php3
Expand Up @@ -10,8 +10,10 @@ If an error occurs you can re-create your previous database by just importing yo
<p>
<font face="courier new">mysql -u[username] -p[password] [database_name] < [filename]</font>
<p>
<a href="admin_upgrade_0_14_0.php3">Upgrade to 0.14.x</a>
<a href="admin_upgrade_0_16_0.php3">Upgrade to 0.16.x</a>
<p>
<a href="admin_upgrade_0_15_0.php3">Upgrade to 0.15.x</a>
<p>
<a href="admin_upgrade_0_14_0.php3">Upgrade to 0.14.x</a>
<p>
Upgrades may take several minutes.
66 changes: 66 additions & 0 deletions admin_upgrade_0_16_0.php3
@@ -0,0 +1,66 @@
<?
require( "constant_inc.php" );
require( "config_inc.php" );
require( "core_database_API.php" );
?>
<?
db_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );

class UpgradeItem {
var $item_count;
var $query_arr;

function UpgradeItem() {
$this->item_count = 0;
$this->query_arr = array();
}

function AddItem( $p_string ) {
$this->query_arr[$this->item_count] = $p_string;
$this->item_count++;
}

function PrintAll() {
for ( $i=0; $i<$this->item_count; $i++ ) {
echo $this->query_arr[$i]."<br>";
}
}

function PerformItem( $p_index ) {
PRINT "Executing upgrade #".$p_index."<br>";
#$result = db_query( $this->query_arr[$p_index] );
}

function PerformAll() {
for ( $i=0; $i<$this->item_count; $i++ ) {
PRINT "Executing upgrade #".$i.": ".$this->query_arr[$i]."<br>";
#$result = db_query( $this->query_arr[$i] );
}
}
}
?>
<?
$upgrade_obj = new UpgradeItem();
$upgrade_obj->AddItem( "ALTER TABLE mantis_bug_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_project_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_bug_table CHANGE os_build os_build VARCHAR(32) NOT NULL" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_bug_table CHANGE build build VARCHAR(32) NOT NULL" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_bug_table CHANGE votes votes INT(4) NOT NULL" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_user_profile_table CHANGE os_build os_build VARCHAR(32) NOT NULL" );
$upgrade_obj->AddItem( "ALTER TABLE mantis_user_pref_table CHANGE language language VARCHAR(32) DEFAULT 'english' NOT NULL" );
$upgrade_obj->AddItem( "CREATE TABLE mantis_bug_history_table (
user_id int(7) unsigned zerofill NOT NULL default '0000000',
bug_id int(7) unsigned zerofill NOT NULL default '0000000',
date_modified datetime NOT NULL default '1970-01-01 00:00:01',
field_name varchar(32) NOT NULL default '',
old_value varchar(128) NOT NULL default '',
new_value varchar(128) NOT NULL default '',
KEY bug_id (bug_id),
KEY user_id (user_id))" );

$upgrade_obj->AddItem( "ALTER TABLE mantis_project_version_table ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL" );

#$upgrade_obj->PrintAll();
$upgrade_obj->PerformAll();
?>
<p>Finished
36 changes: 28 additions & 8 deletions db_generate.sql
Expand Up @@ -17,12 +17,30 @@ CREATE TABLE mantis_bug_file_table (
filename varchar(250) NOT NULL,
folder varchar(250) NOT NULL,
filesize int(11) DEFAULT '0' NOT NULL,
date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
file_type varchar(250) NOT NULL default '',
date_added datetime DEFAULT '1970-01-01 00:00:01' NOT NULL,
content blob NOT NULL,
PRIMARY KEY (id)
);


# --------------------------------------------------------
#
# Table structure for table `mantis_bug_history_table`
#

CREATE TABLE mantis_bug_history_table (
user_id int(7) unsigned zerofill NOT NULL default '0000000',
bug_id int(7) unsigned zerofill NOT NULL default '0000000',
date_modified datetime NOT NULL default '1970-01-01 00:00:01',
field_name varchar(32) NOT NULL default '',
old_value varchar(128) NOT NULL default '',
new_value varchar(128) NOT NULL default '',
KEY bug_id (bug_id),
KEY user_id (user_id)
)


# --------------------------------------------------------
#
# Table structure for table 'mantis_bug_table'
Expand All @@ -46,11 +64,11 @@ CREATE TABLE mantis_bug_table (
eta int(2) DEFAULT '10' NOT NULL,
bug_text_id int(7) unsigned zerofill DEFAULT '0000000' NOT NULL,
os varchar(32) NOT NULL,
os_build varchar(16) NOT NULL,
os_build varchar(32) NOT NULL,
platform varchar(32) NOT NULL,
version varchar(32) NOT NULL,
build tinyint(4) DEFAULT '0' NOT NULL,
votes tinyint(4) DEFAULT '0' NOT NULL,
build varchar(32) DEFAULT '0' NOT NULL,
votes int(4) DEFAULT '0' NOT NULL,
profile_id int(7) unsigned zerofill DEFAULT '0000000' NOT NULL,
summary varchar(128) NOT NULL,
PRIMARY KEY (id)
Expand Down Expand Up @@ -145,7 +163,8 @@ CREATE TABLE mantis_project_file_table (
filename varchar(250) NOT NULL,
folder varchar(250) NOT NULL,
filesize int(11) DEFAULT '0' NOT NULL,
date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
file_type varchar(250) NOT NULL default '',
date_added datetime DEFAULT '1970-01-01 00:00:01' NOT NULL,
content blob NOT NULL,
PRIMARY KEY (id)
);
Expand Down Expand Up @@ -192,7 +211,8 @@ INSERT INTO mantis_project_user_list_table (project_id, user_id, access_level) V

CREATE TABLE mantis_project_version_table (
project_id int(7) unsigned zerofill DEFAULT '0000000' NOT NULL,
version varchar(32) NOT NULL
version varchar(32) NOT NULL default '',
date_order datetime NOT NULL default '1970-01-01 00:00:01'
);

INSERT INTO mantis_project_version_table (project_id, version) VALUES ( '0000001', '0.14.0');
Expand Down Expand Up @@ -221,7 +241,7 @@ CREATE TABLE mantis_user_pref_table (
email_on_bugnote int(1) DEFAULT '0' NOT NULL,
email_on_status int(1) DEFAULT '0' NOT NULL,
email_on_priority int(1) DEFAULT '0' NOT NULL,
language varchar(16) DEFAULT 'english' NOT NULL,
language varchar(32) DEFAULT 'english' NOT NULL,
PRIMARY KEY (id)
);

Expand All @@ -237,7 +257,7 @@ CREATE TABLE mantis_user_profile_table (
user_id int(7) unsigned zerofill DEFAULT '0000000' NOT NULL,
platform varchar(32) NOT NULL,
os varchar(32) NOT NULL,
os_build varchar(16) NOT NULL,
os_build varchar(32) NOT NULL,
description text NOT NULL,
PRIMARY KEY (id)
);
Expand Down
45 changes: 44 additions & 1 deletion db_upgrade.sql
Expand Up @@ -6,6 +6,18 @@
# mysql -u<username> -p<password> <databasename>
#

#----------------------
# Contents
#----------------------
# 0.9.x to 0.10.x
# 0.10.2 to 0.11.0
# 0.11.x to 0.12.0
# 0.12.x to 0.14.0
# 0.14.x to 0.15.0
# 0.15.x to 0.16.0
#----------------------


# =================
# 0.9.x to 0.10.x
# =================
Expand Down Expand Up @@ -331,4 +343,35 @@ ALTER TABLE mantis_project_version_table ADD ver_order INT (7) not null;

# Make the cookie string unique

ALTER TABLE mantis_user_table ADD UNIQUE(cookie_string);
ALTER TABLE mantis_user_table ADD UNIQUE(cookie_string);

# =================
# 0.15.x to 0.16.0
# =================

# Add a type field to the file tables
ALTER TABLE mantis_bug_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize
ALTER TABLE mantis_project_file_table ADD file_type VARCHAR(250) NOT NULL AFTER filesize

# Make some fields larger
ALTER TABLE mantis_bug_table CHANGE os_build os_build VARCHAR(32) NOT NULL
ALTER TABLE mantis_bug_table CHANGE build build VARCHAR(32) NOT NULL
ALTER TABLE mantis_bug_table CHANGE votes votes INT(4) NOT NULL

ALTER TABLE mantis_user_profile_table CHANGE os_build os_build VARCHAR(32) NOT NULL
ALTER TABLE mantis_user_pref_table CHANGE language language VARCHAR(32) DEFAULT 'english' NOT NULL

# Table structure for table `mantis_bug_history_table`
CREATE TABLE mantis_bug_history_table (
user_id int(7) unsigned zerofill NOT NULL default '0000000',
bug_id int(7) unsigned zerofill NOT NULL default '0000000',
date_modified datetime NOT NULL default '1970-01-01 00:00:01',
field_name varchar(32) NOT NULL default '',
old_value varchar(128) NOT NULL default '',
new_value varchar(128) NOT NULL default '',
KEY bug_id (bug_id),
KEY user_id (user_id)
)

ALTER TABLE mantis_project_version_table ADD date_order DATETIME DEFAULT '1970-01-01 00:00:01' NOT NULL

0 comments on commit b827897

Please sign in to comment.