Skip to content

Commit

Permalink
[bug 889271] Fix migration 226
Browse files Browse the repository at this point in the history
This adds the missing product that migration 226 balks at plus
adds a note to migration 226 about how to add products in the future if
it dies again.
  • Loading branch information
willkg committed Aug 16, 2013
1 parent e8fba90 commit a3f08a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion migrations/156-add-products.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
-- Add initial products for SUMO
INSERT INTO products_product (`title`, `description`, `display_order`, `visible`, `slug`) VALUES
('Firefox', 'Web browser for Windows, Mac and Linux', 1, TRUE, 'firefox'),
('Firefox for mobile', 'Web browser for Android smartphones and tablets', 2, TRUE, 'mobile');
('Firefox for mobile', 'Web browser for Android smartphones and tablets', 2, TRUE, 'mobile'),
('Firefox OS', 'Firefox OS', 3, TRUE, 'firefox-os');
4 changes: 3 additions & 1 deletion migrations/226-retopic-questions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ def run():
# Make sure all topics listed in kitsune.questions.question_config exist.
for prod_desc in question_config.products.values():
for product_slug in prod_desc.get('products', []):
# Note: If this fails, add the missing product to
# migration 156.
product = Product.objects.get(slug=product_slug)
for topic_desc in prod_desc['categories'].values():
_, created = Topic.objects.get_or_create(
Expand All @@ -33,4 +35,4 @@ def run():
old_topics__slug=topic.slug)
print '%s / %s (%d questions)' % (product.title, topic.title, len(questions))
for q in questions:
q.topics.add(topic)
q.topics.add(topic)

0 comments on commit a3f08a6

Please sign in to comment.