Skip to content

Performing Production DB Migration

Allen Anthes edited this page Jun 5, 2019 · 2 revisions

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 manage.py 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 manage.py migrate