Add migration to populate site_values in SiteConfigurationHistory - #23236
Conversation
|
I also just checked the PostgreSQL syntax and it should be valid, but I did not test: https://www.postgresql.org/docs/9.1/sql-update.html |
Hmmm - I'm curious why the raw SQL needs to be PostgreSQL-complaint. Are there installations which use it? Does edx.org use it? |
| @@ -0,0 +1,30 @@ | |||
| # -*- coding: utf-8 -*- | |||
| # Written by Troy. | |||
There was a problem hiding this comment.
Nit: Maybe use your Github handle? Or edX email address here? Or just remove this line? Because git knows all...
edx.org does not, but I just figured since one reason we're doing this PR is for the open source community and who knows what they might be trying out. |
Right now the ORM is very unhappy about the JSONField `site_values` in SiteConfigurationHistory containing non-JSON (empty strings). We cannot even write a data migration using the ORM to populate the field because that causes a JSONDeserializationError. Therefore, we must bypass the ORM and populate the values with raw SQL. DENG-18
c3ab1b8 to
06b5470
Compare
|
jenkins run js |
|
jenkins run bokchoy |
|
Your PR has finished running tests. There were no failures. |
|
EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production. |
|
EdX Release Notice: This PR may have caused e2e tests to fail on Stage. If you're a member of the edX org, please visit #e2e-troubleshooting on Slack to help diagnose the cause of these failures. Otherwise, it is the reviewer's responsibility. E2E tests have failed. https://gocd.tools.edx.org/go/tab/pipeline/history/deploy_to_stage |
|
EdX Release Notice: This PR has been deployed to the production environment. |
Right now the ORM is very unhappy about the JSONField
site_valuesin SiteConfigurationHistory containing non-JSON (empty strings). We
cannot even write a data migration using the ORM to populate the field
because that causes a JSONDeserializationError. Therefore, we must
bypass the ORM and populate the values with raw SQL.
DENG-18
Testing in devstack:
DB state before migration:
Running the migration:
DB state after migration:
Running the reverse migration:
DB state after reverse migration: