Migration to a new data model - OscarPDR/labman_ud GitHub Wiki
Since the release of Django 1.7, migrations are natively supported, without the need to rely on tools and extensions such as South.
If you are interested in migrating a legacy labman_ud database with the latest models schema, these are the general steps to perform. Should you have any doubt, don't hesitate to ask us for further details.
- If your installation runs a django version prior to 1.7, first update django (if you are using pip, run:
pip install --upgrade django
) - Remove all the /migrations folders within the apps (you can check the app_list in the INSTALLED_APPS section of settings/base.py
- At the same level as the manage.py file, run:
python manage.py makemigrations
+ settings (if any). This should have created a /migrations folder within each app. - At this moment, you have a file per app with the current schema following your models.py files.
- Bring the latest repository version from GitHub:
git pull
. - Run again the
makemigrations
command. A new file will be created in each apps' /migrations folder with the required updates to perform between schemas. - Run the following command to update the database to the new schemas:
python manage.py migrate
+ settings, if any. Follow the instructions in the prompt during this process, as it may require default values for non-nullable fields. - Re-run your deploy's server and enjoy!