View Issue Details

IDProjectCategoryView StatusLast Update
0009298mantisbtupgradepublic2009-01-15 11:25
Reportermichield Assigned Tojreese  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.1.2 
Target Version1.2.0a3Fixed in Version1.2.0a3 
Summary0009298: upgrade from 1.1.2 to 1.2.0a1 fails
Description

I tried upgrading from 1.1.2 to 1.2.0a1 and here are the results:

  1. when not selecting to "Print SQL Queries instead of Writing to the Database"

I get

APPLICATION ERROR 0000401

Database query failed. Error received from database was 0001062: Duplicate entry '1-bugtracker' for key 2 for the query: INSERT INTO mantis_category_table ( name, project_id ) VALUES ( 'bugtracker', 1 )

  1. when selecting to print the SQL queries I get

category_migrate;

ALTER TABLE mantis_bug_table DROP COLUMN category;

DROP TABLE IF EXISTS mantis_project_category_table;

ALTER TABLE mantis_project_table ADD category_id INTEGER UNSIGNED NOT NULL DEFAULT 1;

INSERT INTO mantis_plugin_table
( basename, enabled ) VALUES
( 'MantisCoreFormatting', '1' );

ALTER TABLE mantis_project_table ADD inherit_global INTEGER UNSIGNED NOT NULL DEFAULT 0;

ALTER TABLE mantis_project_hierarchy_table ADD inherit_parent INTEGER UNSIGNED NOT NULL DEFAULT 0;

ALTER TABLE mantis_plugin_table ADD protected TINYINT NOT NULL DEFAULT '0';

ALTER TABLE mantis_plugin_table ADD priority INTEGER UNSIGNED NOT NULL DEFAULT 3;

ALTER TABLE mantis_project_version_table ADD obsolete TINYINT NOT NULL DEFAULT '0';

ALTER TABLE mantis_bug_table ADD due_date DATETIME NOT NULL DEFAULT '1970-01-01';

INSERT INTO mantis_config_table ( value, type, access_reqd, config_id, project_id, user_id ) VALUES ('82', 1, 90, 'database_version', 20, 0 );

I presume the "category_migrate" is a stored procedure, but I'm a bit afraid this will wipe all my categories, so I didn't apply any of it.

doing "select count(*) from mantis_category_table;" returns 170 entries.

I reverted back to 1.1.2 for now.

TagsNo tags attached.

Relationships

has duplicate 0011416 closedvboctor Upgrade 1.1.8 -> 1.2.0rc1 error - table mantis_category_table 

Activities

michield

michield

2008-06-24 22:35

reporter   ~0018176

another thing, when using the "system_utils" in the admin pages, I get

APPLICATION ERROR 0000401

Database query failed. Error received from database was #1054: Unknown column 'priority' in 'field list' for the query: SELECT basename, priority, protected FROM mantis_plugin_table WHERE enabled=1 ORDER BY priority DESC

michield

michield

2008-06-25 08:24

reporter   ~0018180

I tried deleting all entries in the mantis_category_table (thinking they might be there from some previous attempt or something) but that didn't help:

Tried again and got

Database query failed. Error received from database was 0001062: Duplicate entry '4-templates' for key 2 for the query: INSERT INTO mantis_category_table ( name, project_id ) VALUES ( 'templates', 4 )

So, I guess in "install_functions.php" on line 59, the query needs an "IGNORE"

$query = "INSERT IGNORE INTO $t_category_table ( name, project_id ) VALUES ( " . db_param(0) . ', ' . db_param(1) . ' )';

but in that case you need to check that

$t_category_id = db_insert_id( $t_category_table );

actually returns something and skip the next SQL query if it didn't. That's safe to do, as the query will actually update all entries that match the name of the category and the project ID, so it'll replace all duplicates.


if ($t_category_id) {
$query = "UPDATE $t_bug_table SET category_id=" . db_param(0) . '
WHERE project_id=' . db_param(1) . ' AND category=' . db_param(2);
db_query_bound( $query, array( $t_category_id, $t_project_id, $t_name ) );
}

grangeway

grangeway

2008-06-25 19:01

reporter   ~0018186

John

can you look into what causes this?

Paul

grangeway

grangeway

2008-11-30 16:40

reporter   ~0020165

michield,

Do you still have access to the data set that was generating this error?

Paul

michield

michield

2008-11-30 18:03

reporter   ~0020172

yes, I still have the DB lying around, but if you want, I can also reproduce the error.

All I did was take my 1.1.x installation, copy the DB to a new one, and configure the 1.2.x code to use the copy.

Related Changesets

MantisBT: master 366ff57c

2008-12-09 11:11

jreese


Details Diff
Fix 0009161, 0009298: Upgrading from old database failed when projects had 2+ categories with same name but different case ('Cat' vs 'cat'). Affected Issues
0009161, 0009298
mod - admin/install_functions.php Diff File