Closed
Bug 929321
Opened 12 years ago
Closed 11 years ago
create a script to delete all bugs from the database, and generate two dumps (with and without bugs)
Categories
(bugzilla.mozilla.org :: General, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: glob, Assigned: dkl)
References
Details
Attachments
(1 file)
|
2.04 KB,
patch
|
glob
:
review+
|
Details | Diff | Splinter Review |
it would be very useful for development purposes to have a sanitised dump of the database with the products, components, flags, etc, but without the bugs, attachments, comments, etc. it should greatly reduce the size of the download required to start hacking on bmo.
this will involve creating a script which deletes all bugs.
is _should_ just require:
DELETE FROM bugs_fulltext
DELETE FROM bugs
however Bugzilla::Bug->remove_from_db does a lot more, so there may be missing cascades:
DELETE FROM bug_group_map
DELETE FROM bugs_activity
DELETE FROM cc
DELETE FROM dependencies
DELETE FROM duplicates
DELETE FROM flags
DELETE FROM keywords
DELETE FROM attach_data
DELETE FROM attachments
DELETE FROM bugs
DELETE FROM longdescs
DELETE FROM bugs_fulltext
then after the current sanitised dump is created, the dba would run the nuke-bugs script and create a second file for sharing.
OS: Mac OS X → All
Hardware: x86 → All
Version: Development/Staging → Production
Comment 1•12 years ago
|
||
It would also be really nice to delete the all the profiles... I ran into some constraint issues ( which I didn't look too much into ) when trying to do this with a naive |DELETE FROM profiles| operation.
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → dkl
Status: NEW → ASSIGNED
| Assignee | ||
Comment 2•11 years ago
|
||
(In reply to James Lal [:lightsofapollo] from comment #1)
> It would also be really nice to delete the all the profiles... I ran into
> some constraint issues ( which I didn't look too much into ) when trying to
> do this with a naive |DELETE FROM profiles| operation.
I could add that as an option in a future version. For now I think it would be useful to retain profile information as we already clear out passwords and disable email as part of the sanitizeme.pl script.
dkl
| Assignee | ||
Comment 3•11 years ago
|
||
Attachment #8338680 -
Flags: review?(glob)
Comment on attachment 8338680 [details] [diff] [review]
929321_1.patch
Review of attachment 8338680 [details] [diff] [review]:
-----------------------------------------------------------------
r=glob
there's a few things that would be nice to change, but none are blockers.
::: contrib/nuke-bugs.pl
@@ +22,5 @@
> +
> +GetOptions(
> + "dry-run" => \$dry_run,
> + "trace" => \$trace,
> +) or exit;
rather than using --dry-run, given what this script does i would prefer for this to do a "omg, this will nuke everything, hit return to continue or ctrl^c to cancel". yeah, it should be obvious from the script name, but... :)
with that in place we don't need a dry-run at all.
@@ +30,5 @@
> +$dbh->{TraceLevel} = 1 if $trace;
> +
> +if ($dry_run) {
> + print "** dry run : no changes to the database will be made **\n";
> + $dbh->bz_start_transaction();
it would be safer to always do this work within a transaction block.
@@ +58,5 @@
> +};
> +if ($@) {
> + $dbh->bz_rollback_transaction() if $dry_run;
> + die "$@" if $@;
> +}
there's no need for eval{} .. die will automatically kick off a rollback.
@@ +62,5 @@
> +}
> +
> +sub delete_from_table {
> + my $table = shift;
> + print "Deleting from $table...";
you need to set $| = 1 for this to be useful.
Attachment #8338680 -
Flags: review?(glob) → review+
| Assignee | ||
Comment 5•11 years ago
|
||
Committing to: bzr+ssh://dlawrence%40mozilla.com@bzr.mozilla.org/bmo/4.2
added contrib/nuke-bugs.pl
Committed revision 9162.
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•