Performing Production DB Migration - OperationCode/back-end GitHub Wiki

Kubernetes CLI

We use Kubernetes (k8s) to orchestrate our infrastructure. In production this means if you need to interact with the application you need to setup the k8s cli.

By following those instructions you will have access to the Django console.

Merge Migration

The first step for every DB migration is to create a migration file by running the following in your local development environment:

$ python makemigrations

This command scans the project for any changes made to the database Models since the last migrations and generates a migration file within the application's /migrations/ directory.

Then commit the migration file, merge it into master, and wait for the cluster to update. This allows the Django CLI recognize that there is a current Django migration that can be performed.

Perform Migration

Using the kubectl console you can now run the migration

python migrate