Closed Bug 615904 Opened 14 years ago Closed 14 years ago

Recover category data from migration

Categories

(support.mozilla.org :: Knowledge Base Software, task, P1)

task

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jsocol, Assigned: jsocol)

References

Details

Attachments

(2 files, 1 obsolete file)

Because of bug 615787, we've lost all the category data we had last night. New articles are going to have to be moved manually but articles we migrated can be fixed. We have the migration SQL, we just need to use it to do something like: UPDATE wiki_document SET category = FOO WHERE id = BAR; for all 5700 articles we migrated. Shouldn't be terribly difficult to create some SQL.
I generated this with PHP because iPython was being a jerk and not writing all the SQL to the file. There were 5705 documents as of the migration, this file has 5705 UPDATE statements restoring the category to whatever it was in the migration SQL. I created it by reimporting the migration data and then pulling out the ID and Category of each document.
Assignee: nobody → james
Attachment #494429 - Flags: review?(paulc)
Attachment #494429 - Attachment mime type: application/octet-stream → text/plain
For those who are curious here's the PHP script I used.
Comment on attachment 494429 [details] restore category data as it existed in the migration Q/C: 1. Should we also move templates to the Templates category? Should be something like: UPDATE wiki_document SET category = 60 WHERE is_template = 1; 2. I've nothing against this giant SQL but wouldn't it be easier to say: UPDATE wiki_document SET category = _blah_ WHERE id IN (1,2,3,4...);
1. We can but meh. 2. That's much tougher to generate than this was.
Comment on attachment 494429 [details] restore category data as it existed in the migration r+ James will add that line for templates and I've tested this: the counts are the same. No rows changed afaict.
Attachment #494429 - Flags: review?(paulc) → review+
Here's the final SQL with the template coercion added at the end.
Attachment #494429 - Attachment is obsolete: true
Blocks: 615907
Status: NEW → RESOLVED
Closed: 14 years ago
Depends on: 615930
Resolution: --- → FIXED
You can now test the fix on support-stage. Keep in mind that it only affects articles that were present during the migration. Anything else that was added later is wherever it last was before the fix.
Verified on support-stage that articles have been put back into the Troubleshooting category, and Navigation [which was full yesterday after the release] has zero articles.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: