/
Removing a Djangoapp from an existing project

Removing a Djangoapp from an existing project

As part of Deprecation Process, we will occasionally be responsible for removing an entire djangoapp and all according tables and references from a repository. In most cases, we would like to ensure the data that also existed in the djangoapp is also removed.


Step 1: Clean all code out of the djangoapp, leaving only a barebones version that has migrations and AppConfig

This removal should remove all outside code references to the djangoapp. The only exception to this is the reference to the djangoapp in INSTALLED_APPS.

The directory for the djangoapp should still remain along with the existing migrations directory and a simplistic AppConfig if necessary.

In edx-platform, it may be necessary to skip the test_migrations_are_in_sync test: https://github.com/edx/edx-platform/pull/21336/files#diff-6658eaaa8573ad27cfc48a2560048839R225

Merge in this PR after all tests pass and the code has the required approvals. Ensure it is deployed the production before merging in the next step.

Example: https://github.com/edx/edx-platform/pull/21336

Step 2: Create a migration that removes/drops all tables

This should be auto-generate-able since no more tables should be specified in models.py

If in edx-platform, remove the skip for test_migrations_are_in_sync.

Merge in this PR after tests pass and the code has the required approvals. Wait until it is deployed to production before merging in the next step.

Example: https://github.com/edx/edx-platform/pull/21355

Step 3: Remove djangoapp

Remove the djangoapp directory, including migrations, along with any reference to it in INSTALLED_APPS.

Add a note to the next named release page about the tables that have been removed so the community knows to clean them up themselves. If there is a desire for the open edX community to have an automated migration to remove the app's tables, then you will want to hold off on releasing this step until the following open edX named release.

Merge in this PR after tests pass and the code has the required approvals.

Example: https://github.com/edx/edx-platform/pull/21380

Step 4: Remove permissions related to this djangoapp in app-permissions

If this djangoapp was accessible through django admin, there will probably be app-permissions associated with this djangoapp that will need to be removed quickly from the app-permissions repo by a 2U employee (2U internal only): https://github.com/edx/app-permissions

Remove all entries related to this djangoapp from the app-permissions repo & notify IT of the change.

Example: https://github.com/edx/app-permissions/pull/1113

Related content

Everything About Database Migrations
Everything About Database Migrations
More like this
Aximprovements Engineering Team
Aximprovements Engineering Team
Read with this
Data Loss and Recovery from Migrations and Rollback
Data Loss and Recovery from Migrations and Rollback
More like this
Some Things About Manually Rolling Back Migrations
Some Things About Manually Rolling Back Migrations
More like this
Removing Django MySQL Data From Large Production Tables
Removing Django MySQL Data From Large Production Tables
More like this
Libraries we KNOW we want to move out of the monolith
Libraries we KNOW we want to move out of the monolith
More like this