fidals / stroyprombeton

3 stars 1 forks source link

Take lost categories and products from the old DB #678

Closed duker33 closed 5 years ago

duker33 commented 5 years ago

At #670 we've found the lost categories and products data. Now take it to the prod DB

duker33 commented 5 years ago

High-level pseudocode for the script

- pickle data to json

- take categories
  - take all non-series categories with at least one product
  - redirects

- take products
  - group prods to options
  - find parent categories over series
  - bind them to tags and series
  - redirects

- assert taken categories count: `before + to_take == after`
- assert taken products<->options count: `before + to_take == after`
duker33 commented 5 years ago

i'll log it with astro-hours

duker33 commented 5 years ago

1. Old DB to json

https://gist.github.com/duker33/c26b179d0aff1c054ebd513f59e9cafb

duker33 commented 5 years ago

2. Import categories and products from json

https://gist.github.com/duker33/680082d893aba91995ad9082832e8ffe

duker33 commented 5 years ago

launched the script on prod. Final output:

categories 191 -> 196
products 710 -> 818
options 12197 -> 14132
tags 4073 -> 5699
redirects 197 -> 560
duker33 commented 5 years ago

spent 24 astro hours totally