Closed lingxiaoyang closed 7 years ago
@manumilou There's a hint for enabling MySQL strict mode that "fixes many data integrity problems in MySQL". Do you think it's better to enable this, or don't worry about it?
Investigation of what "not reflected model changes" are:
For meal
:
Existing (meal.0005):
field=models.CharField(choices=[('main_dish', 'Main Dish'), ('dessert', 'Dessert'), ('diabetic', 'Diabetic Dessert'), ('fruit_salad', 'Fruit Salad'), ('green_salad', 'Green Salad'), ('pudding', 'Pudding'), ('compote', 'Compote')], max_length=100, verbose_name='component group'),
To be changed to:
field=models.CharField(choices=[('main_dish', 'Main Dish'), ('dessert', 'Dessert'), ('diabetic', 'Diabetic Dessert'), ('fruit_salad', 'Fruit Salad'), ('green_salad', 'Green Salad'), ('pudding', 'Pudding'), ('compote', 'Compote'), ('sides', 'Sides')], max_length=100, verbose_name='component group'),
For member
:
Existing (member.0025):
field=models.CharField(choices=[('cycling', 'Cycling'), ('walking', 'Walking'), ('driving', 'Driving')], default='cycling', max_length=20, verbose_name='default vehicle'),
To be changed to:
field=models.CharField(choices=[('cycling', 'Cycling'), ('walking', 'Walking'), ('driving', 'Driving')], default='cycling', max_length=20, verbose_name='vehicle'),
For note
:
Existing (note.0009):
migrations.AlterField(
model_name='note',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='note.NoteCategory', verbose_name='Category'),
),
migrations.AlterField(
model_name='note',
name='priority',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='note.NotePriority', verbose_name='Priority'),
),
To be changed to:
migrations.AlterField(
model_name='note',
name='category',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='note.NoteCategory', verbose_name='Category'),
),
migrations.AlterField(
model_name='note',
name='priority',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='note.NotePriority', verbose_name='Priority'),
),
Expected Behaviour
The migrations should always match
models.py
.Actual Behaviour
A fresh installation of sous-chef gives the following warning:
And following
makemigrations
:It seems that sous-chef misses few migration files in the repo.
Steps to reproduce
dev
branchtools/mariadb
folder. It is where the DB is stored.docker-compose stop
,docker-compose rm
anddocker-compose build
to completely rebuild the containers.python manage.py migrate
could work.) You will see the warnings in the console output.