Updating Data Models

There may be times when you need to update the data models used by Django.
This can be done by following these steps:
  1. Make the necessary changes to the models in src/apps/plots/models.py.

  2. Generate the Django migration file(s):

    cd src
    python manage.py makemigrations
    

The migration(s) will be created in the src/apps/plots/migrations/ directory. First check the migration(s) to ensure they are correct. If they are, apply the migration(s):

From within the Django app Docker container:

python manage.py migrate

# or if you are not in the container
docker exec -i live_data_server-django-1 bash -ic '
   cd app
   pixi run -e deploy python manage.py migrate
   '

If the migration(s) are not correct, you can delete them and start again:

python manage.py migrate plots zero
python manage.py makemigrations
python manage.py migrate