openedx / openedx-learning

GNU Affero General Public License v3.0
5 stars 8 forks source link

Add ComponentType model #147

Closed ormsbee closed 7 months ago

ormsbee commented 7 months ago

@kdmccormick, @bradenmacdonald: This is meant to be reviewed after https://github.com/openedx/openedx-learning/pull/143 merges, and builds on top of it.

refactor: normalize component types with ComponentType

Prior to this commit, Components encoded their namespace + type info as
two columns on the Component model itself. This wasted a lot of space on
a very common index lookup–many rows of ('xblock.v1', 'video'),
('xblock.v1', 'problem'), and ('xblock.v1', 'text'). But worse, the lack
of a separate ComponentType model meant that there was no first class
entity to store per-type policy data against. For example, we might want
to say "the following types are supported by libraries, while these
other types are experimental", or "these types are enabled for these
orgs", etc.

Components are required to have a ComponentType. We're rewriting the
first migration for the components app here, since this app hasn't been
added to edx-platform yet.