feat: Legacy Libraries Migration (WIP) - #36083
Conversation
|
Sandbox deployment failed 💥 |
|
Sandbox deployment failed 💥 |
2d66c67 to
0a239e6
Compare
|
@ormsbee , as we've discussed, authors will be able to:
I'm thinking about how to encode both of these kinds of migrations. Here are three ideas, none of which I love. (In each idea, there is a 1. No data model for copy-migrateclass LegacyLibraryForwardedMigration(Model):
source_key = LearningContextKeyField(unique=True)
target_library = ForeignKey(ContentLibrary)
target_collection = ForeignKey(Collection, null=True, unique=True)
migrated_by = ...
migrated_at = ...
# Copy-migrate events are not recorded in the DB2. Shared model for migrate-with-forwarding and copy-migrateclass LegacyLibraryMigration(Model):
source_key = LearningContextKeyField() # should be unique iff `forward==True`
forwarded = BooleanField()
target_library = ForeignKey(ContentLibrary)
target_collection = ForeignKey(Collection, null=True, unique=True)
migrated_by = ...
migrated_at = ...3. Two different data modelsclass LegacyLibraryForwardedMigration(Model):
source_key = LearningContextKeyField(unique=True)
target_library = ForeignKey(ContentLibrary)
target_collection = ForeignKey(Collection, null=True, unique=True)
migrated_by = ...
migrated_at = ...
class LegacyLibraryCopyMigration(Model):
source_key = LearningContextKeyField()
target_library = ForeignKey(ContentLibrary)
target_collection = ForeignKey(Collection, null=True, unique=True)
migrated_by = ...
migrated_at = ...What I want to do (but don't know how to do in Django)class LegacyLibraryMigration(Model):
source_key = LearningContextKeyField()
target_library = ForeignKey(ContentLibrary)
target_collection = ForeignKey(Collection, null=True, unique=True)
migrated_by = ...
migrated_at = ...
class LegacyLibraryMigrationEnableForwarding(Model):
migration = OneToOneField(LegacyLibraryMigration)
source_key = LearningContextKeyField(unique=True)
class Meta:
ensure_equal("source_key", "migration.source_key") # <-- Fake Django. Is this possible? |
0a239e6 to
093dd01
Compare
|
^ We talked through this in the latest libraries sync, and ended up deciding to invert the relationship between the two models. That is: there is a LegacyLibraryMigrationSource row for each legacy library, which is pointed to by many LegacyLibraryMigrations, but which points at a single one of them as the authoritative_migration. |
093dd01 to
1400803
Compare
| target_collection = models.ForeignKey( | ||
| Collection, | ||
| unique=True, # Any given collection should be the target of at most one V1 library migration. | ||
| on_delete=models.SET_NULL, # Collections can be deleted, but the migrated blocks (and the migration) survive. |
There was a problem hiding this comment.
FWIW, Collections aren't really removed, just soft-deleted. So if you wanted to, you could remove the target_library as a separate field, and just rely on this relation to get you to the correct library.
|
@kdmccormick is this PR still relevant, it looks like an early POC of work that has landed? |
|
Nope, it's obsolete now, thanks! |
Description
...
Supporting information
This will be the full implementation of:
Currently blocked by:
This is all part of:
Testing instructions
TBD
Deadline
Needs to land by Teak cutoff (Apr 9) at the very very latest.
Other information
TBD
Sandbox env
Link: TBD
UN/PW: openedx / openedx
Settings
Tutor requirements