Clearing mantis database

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
mchamp
Posts: 1
Joined: 07 Nov 2006, 16:25

Clearing mantis database

Post by mchamp »

I played with Mantis and it's what we were looking for.

Now, I would like to clear the database and start logging real problems.

How do I do that ? :lol:

Thanks :?:
redjen
Posts: 6
Joined: 01 Mar 2006, 00:35

Post by redjen »

I usually do this by dropping, then re-creating the mantis database in mysql.
hmackiernan
Posts: 18
Joined: 17 Feb 2006, 19:23
Location: San Francisco, CA

But first!

Post by hmackiernan »

If you only want to clear out the bugs you've submitted and keep your users and other customizations, you can issue the following SQL to the database
[here I am assuming you're using mysql, your mantis database is named 'bugs' and the table prefix is 'mantis_', the default:

use database bugs;
delete from mantis_bug_table where 1=1;

then, if you want your bug numbers to start once more from '1',
issue this SQL statement:

ALTER TABLE mantis_bug_table AUTO_INCREMENT = 1;
hmackiernan
Posts: 18
Joined: 17 Feb 2006, 19:23
Location: San Francisco, CA

Actually... I spoke too soon... there's more:

Post by hmackiernan »

there are other tables you'd want to truncate as well to clear out bug data:
this SQL should do it:

-- remove all bug data, text, and history
DELETE FROM `mantis_bug_table` WHERE 1;
DELETE FROM `mantis_bug_history_table` WHERE 1;
DELETE FROM `mantis_bug_relationship_table` WHERE 1;
DELETE FROM `mantis_bug_text_table` WHERE 1;
DELETE FROM `mantis_bugnote_table` WHERE 1;
DELETE FROM `mantis_bugnote_text_table` WHERE 1;

-- re-set the autoincrement fields for those tables so that new
-- defects start at '1'
ALTER TABLE `mantis_bug_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_history_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_relationship_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bug_text_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bugnote_table`AUTO_INCREMENT = 1;
ALTER TABLE `mantis_bugnote_text_table`AUTO_INCREMENT = 1;
salomaowk

Re: Clearing mantis database

Post by salomaowk »

This post was perfect to my situation.

There's only one problem, if you look up using this forum search engine nothing like this comes up, but if you use GOOGLE search with simple key words "mantis+clear+database" then you have a lot of previous information.

So, thanks GOOGLE... again...
Post Reply