SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit c4808e2d authored by Mathijs de Bruin's avatar Mathijs de Bruin
Browse files

Document better practises for migrations.

parent 1fb027bf
No related branches found
No related tags found
No related merge requests found
......@@ -75,11 +75,8 @@ Groups and their respective permissions are created using the management command
```
### Create and run migrations
Now that everything is setup, we can setup the datastructures. This is a step you need to repeat
everytime the data structures change (Django should notify you of this):
Now that everything is setup, we can setup the datastructures.
```shell
(scipostenv) $ ./manage.py makemigrations
(scipostenv) $ ./manage.py migrate
```
......@@ -89,3 +86,16 @@ You are now ready to run the development server:
```shell
(scipostenv) $ ./manage.py runserver
```
## Maintaining database migratons
Every time fields in any of the models change, a [database migration](https://docs.djangoproject.com/en/1.10/topics/migrations/)
needs to be created and applied. The first documents a database change and its
inverse, the second actually changes the database.
Make sure to commit the migration to GIT after applying it, so other developers
can use them.
```shell
(scipostenv) $ ./manage.py makemigration
(scipostenv) $ ./manage.py migrate
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment