Upgrade from koa to lilac migration error

Good day! I am upgrading my tutor koa to lilac (hopefully wanting my instance to be upgraded to nutmeg), but I’ve encountered some problem when running tutor local quickstart.

Using the commands:

$ sudo su
$ tutor local stop
$ sudo curl -L "https://github.com/overhangio/tutor/releases/download/v12.2.0/tutor-$(uname -s)_$(uname -m)" -o /usr/local/bin/tutor
$ sudo chmod 0755 /usr/local/bin/tutor
$ tutor --version
$ tutor config save
$ tutor local upgrade --from=koa
$ tutor local quickstart

I ran through some error:


Traceback.txt (5.9 KB)

I don’t know why the migration is looking for some table called shoppingcart_certificateitem when it doesn’t even exist in koa, (unless it should be created in the lilac upgrade), but then why didn’t the migration create it? Or is there a bigger picture prmblem here? Can please someone explain to me what just happened and how to fix it?

First, you should not install Tutor as root.

If you are installing as root because of Docker, you should follow the instructions here or ask you system administrator to do it for you.

I am assuming you are installing on Ubuntu, but if not you should find the appropriate documentation for your operating system.

It is not recommended to launch Tutor as root, we therefore need to add the ubuntu user to the docker group and restart the docker service.

sudo usermod -aG docker ubuntu
sudo service docker restart

We might want to reboot to make sure docker starts at reboot.

sudo reboot

The error “Loading settings $DJANGO_SETTINGS_MODULE” is an indirect result of installing Tutor as root.

Thank you for this suggestion. However, I’ve tried installing tutor from scratch and adding my ubuntu user to the docker group, but sadly, it still has the same error.

I do not see any table shoppingcart_certificateitem on my previous koa instance and I’m not sure if I should really see it, and I’m not quite sure as well why is it looking for it. Should I migrate --fake it?

“shoppingcart_certificateitem” should absolutely be part of your Koa installation. I just launched a vanilla Koa platform with tutor 11.3.1, ran quickstart and that table is there.

mysql> show tables;                                                                                  
+------------------------------------------------------------------+
| Tables_in_openedx                                                |
+------------------------------------------------------------------+
| announcements_announcement                                       |
| api_admin_apiaccessconfig                                        |
| api_admin_apiaccessrequest                                       |
| assessment_assessment                                            |
| assessment_assessmentfeedback                                    |
| assessment_assessmentfeedback_assessments                        |
| assessment_assessmentfeedback_options                            |
...
| schedules_scheduleexperience                                     |
| self_paced_selfpacedconfiguration                                |
| shoppingcart_certificateitem                                     |
| shoppingcart_coupon                                              |
| shoppingcart_couponredemption                                    |
| shoppingcart_courseregcodeitem                                   |
| shoppingcart_courseregcodeitemannotation                         |
...

If you don’t have the shoppingcart_certificateitem table in your MySQL database, then it might mean that you interrupted the migrations halfway. I don’t have a clear path forward for you. Your database might be in a corrupt state. You’ll probably have to fake-rollback some migrations and then re-apply them.

Good luck.

In order to support @regis point, I can also confirm that the various shoppingcart_ related tables were part of our Native Koa installation.

For the sake of completion, here are some personal notes I took when we first looked at migrating our Open edX instance from Native to Tutor for Koa. Please understand that our Open edX instance also started way back with Aspen, so there might be a lot tables creep over the various releases from Aspen to Nutmeg. So I basically compared what we had accumulated over the years and what a default Tutor installation for Koa contained.

We also discovered a few differences between the tables under Native and Tutor when we installed Koa.3.

The tables with < are in Native and the tables with > are in Tutor pour edxapp / openedx database. This is taken from a diff of “show tables” in each environment.

more DIFF-DB 
294d293
< | notifications_articlesubscription                                |
345a345,362
> | shoppingcart_certificateitem                                     |
> | shoppingcart_coupon                                              |
> | shoppingcart_couponredemption                                    |
> | shoppingcart_courseregcodeitem                                   |
> | shoppingcart_courseregcodeitemannotation                         |
> | shoppingcart_courseregistrationcode                              |
> | shoppingcart_courseregistrationcodeinvoiceitem                   |
> | shoppingcart_donation                                            |
> | shoppingcart_donationconfiguration                               |
> | shoppingcart_invoice                                             |
> | shoppingcart_invoicehistory                                      |
> | shoppingcart_invoiceitem                                         |
> | shoppingcart_invoicetransaction                                  |
> | shoppingcart_order                                               |
> | shoppingcart_orderitem                                           |
> | shoppingcart_paidcourseregistration                              |
> | shoppingcart_paidcourseregistrationannotation                    |
> | shoppingcart_registrationcoderedemption                          |
411a429
> | thumbnail_kvstore                                                |
451d468
< | wiki_articlesubscription                                         |

For notifications_articlesubscription and wiki_articlesubscription, I do not understand. They are empty in our Native environment. Should we remove them before the dump or should we edit them in the dump file before restoring the data? It doesn’t cause a problem to leave them in the database as they are unused.

We have not used the old shopping_cart in years. The tables are still in our Native environment though. I don’t understand why the diff considered them missing? shoppingcart_certificateitem is definitely not empty in our Native environment. shoppingcart_order, shoppingcart_orderitem, shoppingcart_paidcourseregistration aren’t either. Old sales from old courses from before Oscar and Otto, and dating back from 2015-08-28 to 2016-06-27 according to the created field in shoppingcart_orderitem.

The “shoppingcart” functionality is deprecated as of the Dogwood release, and it will be removed in a future release. Similar services are now provided by the E-commerce Service.

I assume we switched to ecommerce around 2016-06-28 and before we installed Dogwood. I can’t find the exact date but it seems we migrated from Cypress to Dogwood around that time. Dogwood was released in early 2016 and that would fit with these dates. The first entries in the table order_order in the ecommerce database are from 2016-10-14. That fits.

The old thumbnail_kvstore table has caused us a lot of issues in the past. It does not seem to be in Maple anymore.

The migrations from Koa to Lilac to Maple may have removed some of the differences between Native and Koa since the thumbnail_kvstore table and the shoppingcart tables are no longer in Maple under Tutor.

Supporting the sales from between 2015-08-28 and 2016-06-27 could be difficult.

All that to say that the the various shoppingcart_ related tables were really part of our Native Koa Open edX instance and were removed at some point during migrations from Koa to Lilac or from Lilac to Maple.

I am sorry @Engr_James_Lusuegro if I cannot be of more help at this point.

Thank you for your replies. I’m not quite sure why there was an error though, but I might say that you may be right @regis . The migration before from Koa may have been interrupted.

But as stated here by @sambapete:

This indicates that the shoppingcart_ related tables are no longer needed after the Maple release. Since our main goal is to upgrade into the Nutmeg release, would it cause any more errors if we would migrate --fake the shoppingcart app from Koa to Lilac then Lilac to Maple upgrade?

Either way, thank you for your replies.