ubyssey.ca icon indicating copy to clipboard operation
ubyssey.ca copied to clipboard

Migrate to PostgreSQL from MySQL

Open keeganland opened this issue 3 years ago • 0 comments

Django is optimized to be used with PostgreSQL instead of MySQL, the latter of which is what we currently use. In researching why certain things in our code base were implemented the ways they were, an incredibly common answer ends up being "because doing it in an efficient way would require use of PostgreSQL-only features". Therefore, we need to consider migrating to PostgreSQL

Here are some example such issues that would be addressed by PostgreSQL use:

  • Sometimes there are model fields that make sense to store as arrays which are instead JSON strings. This seems to because only PostgreSQL is compatible with the ArrayField class: https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/fields/#arrayfield
  • Less access to search engine features for articles etc in absence of Postgres: https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/search/
  • Specific warning from running Wagtail migrations: wagtailcore.WorkflowState: (models.W036) MySQL does not support unique constraints with conditions. HINT: A constraint won't be created. Silence this warning if you don't care about it.
  • More robust indexing support on Postgres: https://docs.djangoproject.com/en/3.2/ref/models/indexes/ https://docs.djangoproject.com/en/3.2/ref/contrib/postgres/indexes/

keeganland avatar May 20 '21 23:05 keeganland