-
Notifications
You must be signed in to change notification settings - Fork 17
Description
This repo currently has a set of collation-related helpers that it uses to help normalize model collation behavior between MySQL and SQLite:
- https://github.com/openedx/openedx-learning/blob/main/openedx_learning/lib/collations.py
- https://github.com/openedx/openedx-learning/blob/main/openedx_learning/lib/fields.py
They manifest in the migrations files like this:
openedx-learning/openedx_learning/apps/authoring/publishing/migrations/0001_initial.py
Lines 28 to 29 in 14284d2
| ('key', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_bin', 'sqlite': 'BINARY'}, max_length=500)), | |
| ('title', openedx_learning.lib.fields.MultiCollationCharField(db_collations={'mysql': 'utf8mb4_unicode_ci', 'sqlite': 'NOCASE'}, max_length=500)), |
The MultiCollationCharField is also used in one place in edx-platform
Anyone looking to add PostgreSQL support would need to look for all instances of MultiCollationCharField and MultiCollationTextField and put the postgres-specific mappings there. That includes the convenience methods like case_insensitive_char_field in fields.py, as well as in the individual migration files that have the sqlite/mysql arguments serialized out.