opendata-stuttgart / feinstaub-api

Django project to store sensor pushed via REST api
62 stars 28 forks source link

Migrations #23

Closed karimkawambwa closed 5 years ago

karimkawambwa commented 5 years ago

Ran makemigrations to have migration files for any model changes made recently.

ricki-z commented 5 years ago

two commands should be run in folder feinstaub: python manage.py makemigrations python manage.py migrate

Otherwise changed on models wont be applied to the database. Could you change the travis config for this?

karimkawambwa commented 5 years ago

two commands should be run in folder feinstaub: python manage.py makemigrations python manage.py migrate

Otherwise changed on models wont be applied to the database. Could you change the travis config for this?

I the script start.sh you already run

...
python3 manage.py migrate
...

It is best to only run that command so that it runs migration of the committed migrations in the migrations folder. This way only reviewed migrations will make it to the database.

@ricki-z

ricki-z commented 5 years ago

The changes should have been tested on the system they come from. And with both commands people see how to apply changes to models.

ricki-z commented 5 years ago

And, if you have a system with enough data this will lead to less steps when there was more than 1 change since the last pull on the target system. Think about 3 new auto-migrate files generated by 3 different changes. All on tables with some million datasets. This will be done with 3 i.e. 'ALTER TABLE' one by one with your way, but with only 1 with the two commands if only one table is affected..

karimkawambwa commented 5 years ago

@ricki-z

Its good practice to check migrations along the model changes. Since you recently changed your model, it would be great to have that migration. Maybe you could provide it instead of merging this PR?