Skip to content

Conversation

@bradenmacdonald
Copy link
Member

@bradenmacdonald bradenmacdonald commented Mar 11, 2025

This PR modifies openedx#278 to use multi-table inheritance, so Units are a subclass of Containers.

Features:

  • Unit in python isinstance of Container
  • UnitVersion in python isinstance of ContainerVersion
  • Unit.versioning.draft will give you a UnitVersion, and Container.versioning.draft will give you a ContainerVersion
  • There is only one foreign key to PublishableEntityVersion (on ContainerVersion, not on UnitVersion) ✅
  • Unit and UnitVersion have their own database tables and can be the source/target for unit-specific foreign keys ✅
  • Actually has fewer queries than the original version for most operations ✅
  • Models like Unit and UnitVersion are now so simple that we don't need a ContainerMixin nor ContainerVersionMixin at all ✅
  • How we store metadata is left undecided but this PR maintains complete flexibility.

@bradenmacdonald bradenmacdonald force-pushed the refactor-containers-mt branch from c345f1b to 6061984 Compare March 11, 2025 23:33
@bradenmacdonald bradenmacdonald merged commit 4972f43 into braden/containers-units Mar 12, 2025
8 checks passed
@bradenmacdonald bradenmacdonald deleted the refactor-containers-mt branch March 12, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants